homepage/tmpl/mdwntohtml

53 lines
1.1 KiB
Plaintext
Raw Normal View History

#! /bin/sh
2015-03-21 12:55:18 -06:00
cat <<EOD
<!DOCTYPE html>
<html lang="en">
<head>
EOD
while IFS=': ' read field value; do
case "$field" in
"")
break
;;
Title)
# echo strips leading and trailing whitespace
2015-03-21 12:55:18 -06:00
title=$value
;;
2016-06-03 10:57:13 -06:00
Header)
printf " %s\n" "$value"
;;
Time-stamp)
timestamp=$(printf "%s" "$value" | awk -F '[< ]' '{print $2}')
;;
esac
done
2015-03-20 18:32:15 -06:00
tmpl=$(dirname $0)
2016-06-03 10:57:13 -06:00
cat <<EOF
2015-03-21 12:55:18 -06:00
<title>$title</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" type="text/css" href="/neale/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" media="screen" href="/neale/css/default.css">
<link rel="stylesheet" type="text/css" media="print" href="/neale/css/print.css">
<link rel="icon" type="image/png" href="/neale/face.png">
</head>
<body>
<h1>$title</h1>
2016-06-03 10:57:13 -06:00
EOF
2015-03-21 12:55:18 -06:00
cat $tmpl/head.tmpl
2015-10-29 08:43:15 -06:00
pandoc -f markdown -t html5
2016-06-03 10:57:13 -06:00
[ -n "$timestamp" ] && cat <<EOF
<p id="timestamp">Last modified: $timestamp</p>
EOF
2015-03-20 18:32:15 -06:00
cat $tmpl/foot.tmpl
2016-06-03 10:57:13 -06:00
cat <<EOF
2015-03-21 12:55:18 -06:00
</body>
</html>
2016-06-03 10:57:13 -06:00
EOF