summaryrefslogtreecommitdiff
path: root/make_site_index.sh
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-10-27 23:19:36 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-10-27 23:19:36 -0700
commit4e4e5fa464de6c4057abc677ae316f6f1146909d (patch)
tree99881089c90edad2116513fe4b159fef34ef98e3 /make_site_index.sh
parent7a126d9764e7536d291608889ca7525dcb972769 (diff)
Factored make_site_index.sh out of Makefile.
Diffstat (limited to 'make_site_index.sh')
-rwxr-xr-xmake_site_index.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/make_site_index.sh b/make_site_index.sh
new file mode 100755
index 0000000..f2c758f
--- /dev/null
+++ b/make_site_index.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+SPECVERSION=$1
+SITE=_site
+VERSIONS=`cd $SITE; ls -d -1 0.* | sort -r -g`
+
+echo "% CommonMark Spec\n"
+echo "[**Latest version ($SPECVERSION)**](/$SPECVERSION/)\n"
+echo "Older versions:\n"
+for vers in $VERSIONS
+ do
+ if [ "$vers" != "$SPECVERSION" ]; then
+ perl -p -i -e 's/<div id="watermark">.*?<\/div>/<div id="watermark" style="background-color:black">This is an older version of the spec. For the most recent version, see <a href="http:\/\/spec.commonmark.org">http:\/\/spec.commonmark.org<\/a>.<\/div>/' $SITE/$vers/index.html
+ echo "- [$vers](/$vers/)"
+ fi
+ done