2021-05-09 10:11:33 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
cd "$(git rev-parse --show-toplevel)" || exit 1
|
2021-05-09 15:32:15 +00:00
|
|
|
template="$1"
|
2021-09-20 12:09:52 +00:00
|
|
|
luafilter="$2"
|
|
|
|
orgfile="$3"
|
|
|
|
htmlfile="$4"
|
2021-05-09 10:11:33 +00:00
|
|
|
|
|
|
|
tocoption=""
|
|
|
|
if grep -ie '^#+options:' "$orgfile" | grep 'toc:t'>/dev/null; then
|
|
|
|
tocoption="--toc"
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -x
|
2021-05-09 15:32:15 +00:00
|
|
|
pandoc $tocoption \
|
2021-05-09 10:11:33 +00:00
|
|
|
--template="$template" \
|
2021-09-20 12:09:52 +00:00
|
|
|
--lua-filter="$luafilter" \
|
2021-05-09 10:11:33 +00:00
|
|
|
--mathml \
|
|
|
|
--from org \
|
|
|
|
--to html5 \
|
|
|
|
--standalone \
|
|
|
|
$orgfile \
|
|
|
|
--output "$htmlfile"
|