pyratelog

personal blog
git clone git://git.pyratebeard.net/pyratelog.git
Log | Files | Refs | README

commit 0f934801ffb0040be629e2eb5d9b5eb4c7c37a59
parent 8331795401b1e5ee6b2caf35ba3922b23841335d
Author: pyratebeard <root@pyratebeard.net>
Date:   Thu, 17 Nov 2022 21:18:58 +0000

as_a_matter_of_course

Diffstat:
Mentry/as_a_matter_of_course.md | 18++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/entry/as_a_matter_of_course.md b/entry/as_a_matter_of_course.md @@ -1,6 +1,6 @@ This web log as been through a number of iterations. First I used Jekyll on Github Pages, then I switched to Hugo using a docker container and Gitlab's CI/CD pipeline, and finally the current setup. -I moved away from the docker container as the build started failing and I hit too many issues trying to get it working. In an effort to simplify everything I thought why couldn't I write my posts in markdown then use [pandoc](https://pandoc.org/){target="_blank" rel="noreferrer"} to convert them to HTML, it is a oneliner +I moved away from the docker container as the build started failing and I hit too many issues trying to get it working. In an effort to simplify everything I thought why couldn't I write my posts in markdown then use [pandoc](https://pandoc.org/){target="_blank" rel="noreferrer"} to convert them to HTML? ``` pandoc -f markdown -t html -o new_post.html new_post.md ``` @@ -19,10 +19,12 @@ pandoc -s \ entry/${input}.md ``` +The pyratelog.sh script also sets the link on the main page and adds the entry to my _rss.xml_ file. + Over time I have included three more scripts to improve my writing workflow, [draft](https://git.pyratebeard.net/pyratelog/file/scripts/draft.html){target="_blank" rel="noreferrer"}, [preview](https://git.pyratebeard.net/pyratelog/file/scripts/preview.html){target="_blank" rel="noreferrer"}, and [publish](https://git.pyratebeard.net/pyratelog/file/scripts/publish.html). -``` -#!/bin/sh +The `draft` script will checkout a new or existing branch based on the name I pass it, the name will be the title of the post. +``` # use arg as title and set post file path TITLE=$1 POST="entry/${TITLE}.md" @@ -30,14 +32,22 @@ POST="entry/${TITLE}.md" # checkout the correct branch git branch | grep ${TITLE} && \ git checkout -q ${TITLE} || \ - $(git checkout -q main && git checkout -q -b ${TITLE}) || exit 1 + $(git checkout -q main && git checkout -q -b ${TITLE}) +``` +It will then open up a new or the existing file with that same name in `vim`. +``` # if post file does not exist yet touch it [ -f "${POST}" ] || touch "${POST}" # open post file in favourite editor vim "${POST}" +``` +Now I let my creative juices flow to produce more enjoyable content for you. + +Once I have finished and close `vim` the `draft` script continues by adding and committing the changes to `git`. +``` # when vim closes add and commit the changes # if there are any git status | grep "${POST}" || exit 0