make-web/src/index.ps

46 lines
717 B
PostScript
Raw Normal View History

2023-10-23 13:19:55 +02:00
#!/bin/ksh
2023-10-24 08:08:46 +02:00
# chdir to working directory
cd src/posts
2023-10-23 13:19:55 +02:00
2023-10-24 08:08:46 +02:00
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
2023-10-23 22:39:52 +02:00
2023-10-24 08:08:46 +02:00
# print list
2023-11-03 13:36:38 +01:00
ls -r1 *.ps *.pm *.ph *.pa *.pt 2>/dev/null | fgrep -v '.draft.' | while read line
2023-10-23 13:19:55 +02:00
do
2023-11-03 13:48:18 +01:00
if [ $(echo "${line##*.}") == "pm" ]
then
TITLE="$(head -1 "$line" | sed 's/^# //g')"
else
TITLE="$(echo "${line%%.*}" | tr '_' ' ')"
fi
2023-11-03 13:49:18 +01:00
URI="posts/${line%.*}.html"
2023-10-24 08:08:46 +02:00
cat <<EOF
<li>
<a href="$URI">
$TITLE
</a>
</li>
EOF
2023-10-23 13:19:55 +02:00
done
2023-10-24 08:08:46 +02:00
cat <<EOF
</ul>
EOF
2023-10-23 13:19:55 +02:00