From 88c1d0d6269f967c5faa32e4b3046409dfe91c8a Mon Sep 17 00:00:00 2001
From: Neale Pickett
Date: Fri, 3 Jun 2016 16:57:13 +0000
Subject: [PATCH] Last-modified .mdwn header
---
css/format.css | 4 ++++
papers/setup.mdwn | 2 +-
tmpl/mdwntohtml | 23 ++++++++++++++++-------
3 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/css/format.css b/css/format.css
index c83cb44..532e480 100644
--- a/css/format.css
+++ b/css/format.css
@@ -46,3 +46,7 @@ address a:before {
padding: 0.5em;
}
+#timestamp {
+ font-size: small;
+ text-indent: inherit;
+}
diff --git a/papers/setup.mdwn b/papers/setup.mdwn
index 2ad94fe..e7201f5 100644
--- a/papers/setup.mdwn
+++ b/papers/setup.mdwn
@@ -1,9 +1,9 @@
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/)
I thought it might be interesting to write up my own.
-29 December, 2015
Who are you, and what do you do?
diff --git a/tmpl/mdwntohtml b/tmpl/mdwntohtml
index 5a72c86..c1aca21 100755
--- a/tmpl/mdwntohtml
+++ b/tmpl/mdwntohtml
@@ -15,15 +15,18 @@ while IFS=': ' read field value; do
# echo strips leading and trailing whitespace
title=$value
;;
- Header)
- printf " %s\n" "$value"
- ;;
+ Header)
+ printf " %s\n" "$value"
+ ;;
+ Time-stamp)
+ timestamp=$(printf "%s" "$value" | awk -F '[< ]' '{print $2}')
+ ;;
esac
done
tmpl=$(dirname $0)
-cat <$title
@@ -33,11 +36,17 @@ cat <
$title
-EOD
+EOF
cat $tmpl/head.tmpl
pandoc -f markdown -t html5
+
+[ -n "$timestamp" ] && cat <Last modified: $timestamp
+EOF
+
cat $tmpl/foot.tmpl
-cat <
-EOD
+EOF