aboutsummaryrefslogtreecommitdiff
path: root/make_site_index.sh
blob: 37eb1fa9b84da75552934cd2302e92acfb7a55e0 (plain)
  1. #!/bin/sh
  2. SPECVERSION=$1
  3. SITE=_site
  4. VERSIONS=`cd $SITE; ls -d -1 0.* | sort -r -g`
  5. echo "% CommonMark Spec\n"
  6. date=`grep '<div class="version">' $SITE/$SPECVERSION/index.html | perl -pe 's/^.*(\d\d\d\d-\d\d-\d\d).*$/\1/'`
  7. echo "[**Latest version ($SPECVERSION)** ($date)](/$SPECVERSION/)\n"
  8. echo "Older versions:\n"
  9. for vers in $VERSIONS
  10. do
  11. date=`grep '<div class="version">' $SITE/$vers/index.html | perl -pe 's/^.*(\d\d\d\d-\d\d-\d\d).*$/\1/'`
  12. if [ "$vers" != "$SPECVERSION" ]; then
  13. 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
  14. echo "- [$vers ($date)](/$vers/)"
  15. fi
  16. done