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