make runnable locally

trunk
vilmibm 2022-05-23 09:34:25 -05:00
parent 3fef4388be
commit 1fb18f9f9f
2 changed files with 20 additions and 25 deletions

39
make.sh
View File

@ -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 "<h2 class=\"title\">${title}</h2>" >> $htmlIndex
echo "<a class=\"pubdate\" name=\"${slug}\" href=\"https://tilde.town/~vilmibm/blog#${slug}\">${pubdate}</a>" >> $htmlIndex
echo "<div class=\"post\">" >> $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 "</div>" >> $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

View File

@ -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.