Last-modified .mdwn header

This commit is contained in:
Neale Pickett 2016-06-03 16:57:13 +00:00
parent e13356da0f
commit 88c1d0d626
3 changed files with 21 additions and 8 deletions

View File

@ -46,3 +46,7 @@ address a:before {
padding: 0.5em; padding: 0.5em;
} }
#timestamp {
font-size: small;
text-indent: inherit;
}

View File

@ -1,9 +1,9 @@
Title: The Setup / Neale Pickett Title: The Setup / Neale Pickett
Time-stamp: <2016-06-03 10:47:45 neale>
After reading [Russ Cox's setup](http://russ.cox.usesthis.com/) After reading [Russ Cox's setup](http://russ.cox.usesthis.com/)
I thought it might be interesting to write up my own. I thought it might be interesting to write up my own.
29 December, 2015
Who are you, and what do you do? Who are you, and what do you do?

View File

@ -15,15 +15,18 @@ while IFS=': ' read field value; do
# echo strips leading and trailing whitespace # echo strips leading and trailing whitespace
title=$value title=$value
;; ;;
Header) Header)
printf " %s\n" "$value" printf " %s\n" "$value"
;; ;;
Time-stamp)
timestamp=$(printf "%s" "$value" | awk -F '[< ]' '{print $2}')
;;
esac esac
done done
tmpl=$(dirname $0) tmpl=$(dirname $0)
cat <<EOD cat <<EOF
<title>$title</title> <title>$title</title>
<meta name="viewport" content="width=device-width"> <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" href="/neale/css/font-awesome.min.css">
@ -33,11 +36,17 @@ cat <<EOD
</head> </head>
<body> <body>
<h1>$title</h1> <h1>$title</h1>
EOD EOF
cat $tmpl/head.tmpl cat $tmpl/head.tmpl
pandoc -f markdown -t html5 pandoc -f markdown -t html5
[ -n "$timestamp" ] && cat <<EOF
<p id="timestamp">Last modified: $timestamp</p>
EOF
cat $tmpl/foot.tmpl cat $tmpl/foot.tmpl
cat <<EOD
cat <<EOF
</body> </body>
</html> </html>
EOD EOF