#!/bin/sh
SPECVERSION=$1
SITE=_site
VERSIONS=`cd $SITE; ls -d -1 0.* | sort -r -g`
echo "% CommonMark Spec\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/