#!/bin/sh
SPECVERSION=$1
SITE=_site
VERSIONS=`cd $SITE; ls -d -1 0.* | sort -r -g`
echo "% CommonMark Spec"
echo ""
date=`grep '
' $SITE/$SPECVERSION/index.html | perl -pe 's/^.*(\d\d\d\d-\d\d-\d\d).*$/\1/'`
echo "[**Latest version ($SPECVERSION)**](/$SPECVERSION/) ($date)"
echo ""
echo "[discussion forum](http://talk.commonmark.org/) | "
echo "[interactive dingus](/dingus.html) | "
echo "[repository](https://github.com/jgm/CommonMark/)"
echo ""
echo "Older versions:"
echo ""
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/