From 4e4e5fa464de6c4057abc677ae316f6f1146909d Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 27 Oct 2014 23:19:36 -0700 Subject: Factored make_site_index.sh out of Makefile. --- make_site_index.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 make_site_index.sh (limited to 'make_site_index.sh') 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>/
This is an older version of the spec. For the most recent version, see http:\/\/spec.commonmark.org<\/a>.<\/div>/' $SITE/$vers/index.html + echo "- [$vers](/$vers/)" + fi + done -- cgit v1.2.3 From 2e27dc3c3fef3ff826dd5406d18e31bccc7d6d1f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 27 Oct 2014 23:26:38 -0700 Subject: Add date to index of versions. --- make_site_index.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'make_site_index.sh') diff --git a/make_site_index.sh b/make_site_index.sh index f2c758f..37eb1fa 100755 --- a/make_site_index.sh +++ b/make_site_index.sh @@ -5,12 +5,14 @@ SITE=_site VERSIONS=`cd $SITE; ls -d -1 0.* | sort -r -g` echo "% CommonMark Spec\n" -echo "[**Latest version ($SPECVERSION)**](/$SPECVERSION/)\n" +date=`grep '
' $SITE/$SPECVERSION/index.html | perl -pe 's/^.*(\d\d\d\d-\d\d-\d\d).*$/\1/'` +echo "[**Latest version ($SPECVERSION)** ($date)](/$SPECVERSION/)\n" echo "Older versions:\n" for vers in $VERSIONS do + date=`grep '
' $SITE/$vers/index.html | perl -pe 's/^.*(\d\d\d\d-\d\d-\d\d).*$/\1/'` if [ "$vers" != "$SPECVERSION" ]; then perl -p -i -e 's/
.*?<\/div>/
This is an older version of the spec. For the most recent version, see http:\/\/spec.commonmark.org<\/a>.<\/div>/' $SITE/$vers/index.html - echo "- [$vers](/$vers/)" + echo "- [$vers ($date)](/$vers/)" fi done -- cgit v1.2.3 From ec8c13d8949e0e4bf5a3a72739c9f8c37a6d3b9f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 27 Oct 2014 23:36:20 -0700 Subject: Added links to spec page. --- make_site_index.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'make_site_index.sh') diff --git a/make_site_index.sh b/make_site_index.sh index 37eb1fa..d11dbe0 100755 --- a/make_site_index.sh +++ b/make_site_index.sh @@ -6,13 +6,16 @@ VERSIONS=`cd $SITE; ls -d -1 0.* | sort -r -g` echo "% CommonMark Spec\n" date=`grep '