From 1fb18f9f9f90da71d8a1b52be5783fda9bbea5bb Mon Sep 17 00:00:00 2001 From: vilmibm Date: Mon, 23 May 2022 09:34:25 -0500 Subject: [PATCH] make runnable locally --- make.sh | 39 +++++++++++++++++++-------------------- posts/0001_newblog.md | 6 +----- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/make.sh b/make.sh index d86cdd2..0ce4a78 100755 --- a/make.sh +++ b/make.sh @@ -1,23 +1,22 @@ #!/bin/bash set -e -# global -pd=/usr/bin/pandoc -g=/bin/grep -tr=/usr/bin/tr -sed=/bin/sed -sort=/usr/bin/sort -postDir=/home/vilmibm/blog/posts +mkdir -p "${HOME}/public_gopher/blog" > /dev/null +mkdir -p "${HOME}/public_gemini/blog" > /dev/null +mkdir -p "${HOME}/public_html/blog" > /dev/null -htmlDir=/home/vilmibm/public_html/blog -htmlIndexTmpl=/home/vilmibm/blog/index.tmpl.html -htmlIndex=/home/vilmibm/public_html/blog/index.html +srcDir=$HOME/blog +postDir=$srcDir/posts -gopherPath=/home/vilmibm/public_gopher/blog +htmlIndexTmpl=$srcDir/index.tmpl.html +htmlDir=$HOME/public_html/blog +htmlIndex=$HOME/public_html/blog/index.html + +gopherPath=$HOME/public_gopher/blog gopherIndex="${gopherPath}/gophermap" -geminiPath=/home/vilmibm/public_gemini/blog +geminiPath=$HOME/public_gemini/blog geminiIndex="${geminiPath}/index.gmi" cd $postDir > /dev/null @@ -31,7 +30,7 @@ fi cp $htmlIndexTmpl $htmlIndex # Remove old gopher posts -rm ${gopherPath}/* +rm -f ${gopherPath}/* # Initialize blog gophermap echo "!the phlog of vilmibm as it were" > $gopherIndex @@ -41,11 +40,11 @@ echo >> $gopherIndex echo "the gemblog of vilmibm as it were" > $geminiIndex echo >> $geminiIndex -for p in $(ls *.md | $sort -r) +for p in $(ls *.md | sort -r) do - pubdate=$($g "pubdate:" $p | $sed 's/pubdate: //') - title=$($g "title:" $p | $sed 's/title: //') - slug=$($g "slug:" $p | $sed 's/slug: //' | $tr -d \[:blank:\]) + pubdate=$(grep "pubdate:" $p | sed 's/pubdate: //') + title=$(grep "title:" $p | sed 's/title: //') + slug=$(grep "slug:" $p | sed 's/slug: //' | tr -d \[:blank:\]) if [ -z "$pubdate" ] || [ -z "$title" ] || [ -z "$slug" ] then echo "warning: missing at least one of: pubdate, slug, title in ${p}" @@ -54,7 +53,7 @@ do echo "

${title}

" >> $htmlIndex echo "${pubdate}" >> $htmlIndex echo "
" >> $htmlIndex - $g -v "pubdate:" $p | $g -v "title:" | $g -v "slug:" |$pd -fmarkdown -thtml >> $htmlIndex + grep -v "pubdate:" $p | grep -v "title:" | grep -v "slug:" | pandoc -fmarkdown -thtml >> $htmlIndex echo "
" >> $htmlIndex # Gopher @@ -63,7 +62,7 @@ do echo "# ${title}" > $gopherPostPath echo >> $gopherPostPath echo "_published ${pubdate}_" >> $gopherPostPath - $g -v "pubdate:" $p | $g -v "title:" | $g -v "slug:" >> $gopherPostPath + grep -v "pubdate:" $p | grep -v "title:" | grep -v "slug:" >> $gopherPostPath # Gemini echo "=> gemini://tilde.town/~vilmibm/blog/${slug}.gmi ${title}" >> $geminiIndex @@ -71,7 +70,7 @@ do echo "# ${title}" > $geminiPostPath echo >> $geminiPostPath echo "_published ${pubdate}_" >> $geminiPostPath - $g -v "pubdate:" $p | $g -v "title:" | $g -v "slug:" >> $geminiPostPath + grep -v "pubdate:" $p | grep -v "title:" | grep -v "slug:" >> $geminiPostPath fi done diff --git a/posts/0001_newblog.md b/posts/0001_newblog.md index 024f3de..9116e95 100644 --- a/posts/0001_newblog.md +++ b/posts/0001_newblog.md @@ -17,8 +17,4 @@ Some initial posting fodder: * My "religious" interests in Discordianism and Hermeticism * Fiction/poetry/essays -Technically speaking, this is all powered by some markdown files with custom metadata embedded in it and a <100 line bash script(0). - -TODO: decide on link formatting/processing. Considering a (LINK _url with protocol_ _title_) macro that either replaces with anchor tag for html or creates a footnote link in gopher or gemini style. - -=> https://git.tilde.town/vilmibm/blog/src/branch/trunk/make.sh 0: this blog's bash script +Technically speaking, this is all powered by some markdown files with custom metadata embedded in it and a <100 line (LINK https://git.tilde.town/vilmibm/blog/src/branch/trunk/make.sh bash script). I considered a static site generator...but I prefer scripting my own thing wrt blogging. It keeps me humble and I find that I don't use most of the features of off the shelf things. I wanted to take an idiosyncratic approach to drafting posts and have control over posting to all three of html, gemini, and gopher.