aboutsummaryrefslogtreecommitdiff
path: root/make_site_index.sh
blob: d11dbe065e22f73dc1fca303b68e4a614e550bcb (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)**](/$SPECVERSION/) ($date)\n"
  8. echo "[discussion forum](http://talk.commonmark.org/) | "
  9. echo "[interactive dingus](/dingus.html) | "
  10. echo "[repository](https://github.com/jgm/CommonMark/)\n"
  11. echo "Older versions:\n"
  12. for vers in $VERSIONS
  13. do
  14. date=`grep '<div class="version">' $SITE/$vers/index.html | perl -pe 's/^.*(\d\d\d\d-\d\d-\d\d).*$/\1/'`
  15. if [ "$vers" != "$SPECVERSION" ]; then
  16. 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
  17. echo "- [$vers](/$vers/) ($date)"
  18. fi
  19. done