#!/bin/sh
# add a special header to all entries
cat << EOF
$1
my blog
EOF
# make this page be the index if it is called with no arguments
[ -z "$1" ] && {
cat << EOF
blog entries
EOF
# list all the files in the directory
for file in *.md; do
printf "- %s
" "${file%.*}.html" "$file"
done
cat << EOF
EOF
} || {
# convert the markdown page to html text
md2html $1
# add a back button
cat << EOF
go back to list
EOF
}
# and a footer
cat << EOF
EOF