46 lines
717 B
PostScript
46 lines
717 B
PostScript
#!/bin/ksh
|
|
|
|
# chdir to working directory
|
|
cd src/posts
|
|
|
|
cat <<'EOF'
|
|
<h1>
|
|
Welcome!
|
|
</h1>
|
|
<p>
|
|
Welcome to my little place on the web. It may not been the pretties
|
|
you've seen today, but it's all self made.
|
|
</p>
|
|
<h2>
|
|
Posts
|
|
</h2>
|
|
<ul>
|
|
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 <<EOF
|
|
<li>
|
|
<a href="$URI">
|
|
$TITLE
|
|
</a>
|
|
</li>
|
|
EOF
|
|
|
|
done
|
|
|
|
cat <<EOF
|
|
</ul>
|
|
EOF
|
|
|
|
|