12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #!/bin/bash
- [ "x${DEBUG+set}" = 'xset' ] && set -v
- set -e
- echo $1
- FILE=${1%.md}
- cat $1 > temp.md
- OPTS=
- if [ "${FILE}" != "./index" ]; then
- if [[ $FILE == *index ]]
- then
- DEST="../"
- else
- DEST="./"
- fi
- RETURN="<a href='$DEST'>Back to previous index</a>"
- OPTS="-T Libreboot"
- else
- OPTS="--css /headercenter.css"
- fi
- if [ "${FILE}" != "./docs/fdl-1.3" ] && [ "${FILE}" != "./conduct" ]; then
- cat footer.md >> temp.md
- fi
- sed temp.md -i -e 's/\.md\(#[a-z\-]*\)*)/.html\1)/g'
- sed temp.md -i -e 's/\.md\(#[a-z\-]*\)*]/.html\1]/g'
- TOC=$(grep -q "^x-toc-enable: true$" temp.md && echo "--toc --toc-depth=2") || TOC=""
- SMART=$(pandoc -v | grep -q '2\.0' || echo "--smart") || SMART=""
- pandoc $TOC $SMART temp.md -s --css /global.css $OPTS \
- --template template.html --metadata return="$RETURN"> $FILE.html
- pandoc $1 > $FILE.bare.html
- sed $FILE.html -i -e 's_^<h\([123]\) id="\(.*\)">\(.*\)</h\1>_<div class="h"><h\1 id="\2">\3</h\1><a aria-hidden="true" href="#\2">[link]</a></div>_'
|