publish.sh 694 B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. echo $1
  3. FILE=${1%.md}
  4. # if not homepage, add a link back to the homepage
  5. if [ "${FILE}" != "./index" ]; then
  6. RETURN="<p><a href='/index.md'>Go back to homepage</a></p>"
  7. fi
  8. cat $1 > temp.md
  9. echo "[License](license.md)" >> temp.md
  10. # change out .md -> .html
  11. sed temp.md -i -e 's/\.md\(#[a-z\-]*\)*)/.html\1)/g'
  12. # work around issue #2872
  13. TOC=$(grep -q "^x-toc-enable: true$" temp.md && echo "--toc")
  14. # work around heterogenous pandoc versions
  15. SMART=$(pandoc -v | grep -q '2\.0' || echo "--smart")
  16. # chuck through pandoc
  17. pandoc $SMART temp.md -s --css /global.css --section-divs -T Libreboot $TOC \
  18. --template=template.html --metadata "return=$RETURN" > $FILE.html