#!/bin/ksh
# chdir to working directory
cd src/posts
cat <<'EOF'
Welcome!
Welcome to my little place on the web. It may not been the pretties
you've seen today, but it's all self made.
Posts
EOF
# print list
ls -r1 *.ps *.pm *.ph *.pa *.pt 2>/dev/null | fgrep -v '.draft.' | while read line
do
if [ $(echo "${line##*.}") == "pm" ]
then
TITLE="$(head -1 "$line" | sed 's/^# //g')"
else
TITLE="$(echo "${line%%.*}" | tr '_' ' ')"
fi
URI="posts/${line%%.*}.html"
cat <
$TITLE
EOF
done
cat <
EOF