anarchyplanet-site/publish.sh
sceox f596aa50b3 Switch to lowdown for markdown conversion
Lowdown is fairly simple while supporting the PHP Extra extensions.

It also comes with extensive documentation in its man pages, for example
the whole language is described in lowdown(5).

See https://kristaps.bsd.lv/lowdown/

This fixes a big TODO (anchor links for the table of contents on the
webring page).
2021-11-30 20:42:35 -08:00

24 lines
737 B
Bash
Executable File

#!/usr/bin/env bash
PUB_DIR=${1:-/home/html/planet/static}
FILES=md/*.md
test -d tmp || mkdir tmp
for f in $FILES
do
filename=$(basename -- $f .md)
echo "publishing md/$filename.md to $PUB_DIR/$filename.html"
lowdown -o tmp/$filename.html $f
sed -i 's/^/ /' tmp/$filename.html
cp head.html tmp/
# set the title
title="$(echo $filename | awk '{for(i=1;i<=NF;i++){ $i=toupper(substr($i,1,1)) substr($i,2) }}1')"
echo " <title>$title • Anarchy Planet</title>" >> tmp/head.html
echo " </head>" >> tmp/head.html
echo " <body>" >> tmp/head.html
# compile the elements in order
cat tmp/head.html nav.html tmp/$filename.html foot.html tail.html \
> $PUB_DIR/$filename.html
done