publish.sh 660 B

12345678910111213141516171819202122232425262728
  1. #!/bin/sh
  2. echo $1
  3. FILE=${1%.md}
  4. # get title block
  5. head -n 4 $FILE.md > temp.md
  6. # if not homepage, add a link back to the homepage
  7. if [ "${FILE}" != "./index" ]; then
  8. printf "[Go back to homepage](/index.md)\n\n" >> temp.md
  9. fi
  10. #read rest of file
  11. tail -n +5 $FILE.md >> temp.md
  12. # change out .md -> .html
  13. sed temp.md -i -e 's/.md\(#[a-z\-]*\)*)/.html\1)/g'
  14. # work around issue #2872
  15. TOC=$(grep -q "^x-toc-enable: true$" temp.md && echo "--toc")
  16. # work around heterogenous pandoc versions
  17. SMART=$(pandoc -v | grep -q '2\.0' || echo "--smart")
  18. # chuck through pandoc
  19. pandoc $SMART temp.md -s --css /global.css --section-divs -T Libreboot $TOC > $FILE.html