* add an empty footer * add a minimal html header * indent the nav * modify the build process (publish.sh): * use a tmp directory * use discount markdown(1) rather than discount mkd2html(1) * generate html page title from the file name * indent html body * use cat(1) to combine the pieces * remove trailing newlines in publish.sh * git ignore tmp/ directory
24 lines
738 B
Bash
Executable File
24 lines
738 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"
|
|
markdown -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
|