#! /bin/sh
cat <
EOD
while IFS=': ' read field value; do
case "$field" in
"")
break
;;
Title)
# echo strips leading and trailing whitespace
title=$value
;;
Header)
printf " %s\n" "$value"
;;
Time-stamp)
timestamp=$(printf "%s" "$value" | awk -F '[< ]' '{print $2}')
;;
esac
done
tmpl=$(dirname $0)
cat <$title
$title
EOF
cat $tmpl/head.tmpl
pandoc -f markdown -t html5
[ -n "$timestamp" ] && cat <Last modified: $timestamp
EOF
cat $tmpl/foot.tmpl
cat <
EOF