2022-02-16 00:53:01 -05:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
cd `dirname $0`
|
|
|
|
|
|
|
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
2022-02-18 15:59:12 -05:00
|
|
|
osoptions=""
|
2022-02-16 00:53:01 -05:00
|
|
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
2022-02-18 15:59:12 -05:00
|
|
|
osoptions=""
|
2022-02-16 00:53:01 -05:00
|
|
|
elif [[ "$OSTYPE" == "cygwin" ]]; then
|
2022-02-18 15:59:12 -05:00
|
|
|
osoptions="--fail-if-warnings --eol=lf "
|
2022-02-16 00:53:01 -05:00
|
|
|
elif [[ "$OSTYPE" == "msys" ]]; then
|
2022-02-18 15:59:12 -05:00
|
|
|
osoptions="--fail-if-warnings --eol=lf "
|
2022-02-16 00:53:01 -05:00
|
|
|
fi
|
2022-02-22 01:56:03 -05:00
|
|
|
templates="./pandoc_templates"
|
|
|
|
options=$osoptions"--toc -N --toc-depth=5 --wrap=preserve --metadata=lang:en --include-in-header=$templates/icon.pandoc --include-before-body=$templates/before.pandoc --css=$templates/style.css -o"
|
2022-02-18 15:59:12 -05:00
|
|
|
for f in *.md
|
2022-02-16 00:53:01 -05:00
|
|
|
do
|
|
|
|
len=${#f}
|
|
|
|
base=${f:0:($len-3)}
|
|
|
|
if [ $f -nt $base.html ];
|
|
|
|
then
|
|
|
|
katex=""
|
2022-02-18 15:59:12 -05:00
|
|
|
mine="--include-after-body=$templates/after.pandoc "
|
2022-03-07 23:43:53 -05:00
|
|
|
for i in 1 2 3 4 5 6
|
2022-02-16 00:53:01 -05:00
|
|
|
do
|
2022-02-18 15:59:12 -05:00
|
|
|
read line
|
2022-02-16 00:53:01 -05:00
|
|
|
if [[ $line =~ katex$ ]];
|
2022-02-18 15:59:12 -05:00
|
|
|
then
|
|
|
|
katex=" --katex=./"
|
|
|
|
fi
|
|
|
|
if [[ $line =~ notmine$ ]];
|
|
|
|
then
|
|
|
|
mine=" "
|
|
|
|
fi
|
2022-02-16 00:53:01 -05:00
|
|
|
done <$f
|
2022-02-18 15:59:12 -05:00
|
|
|
pandoc $katex $mine $options $base.html $base.md
|
2022-02-16 00:53:01 -05:00
|
|
|
echo "$base.html from $f"
|
2022-02-18 15:59:12 -05:00
|
|
|
|
2022-02-16 00:53:01 -05:00
|
|
|
#else
|
|
|
|
# echo " $base.html up to date"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
cd libraries
|
2022-02-22 01:56:03 -05:00
|
|
|
templates="../pandoc_templates"
|
|
|
|
options=$osoptions"--toc -N --toc-depth=5 --wrap=preserve --metadata=lang:en --include-in-header=$templates/icondotdot.pandoc --include-before-body=$templates/beforedotdot.pandoc --css=$templates/style.css --include-after-body=$templates/after.pandoc -o"
|
2022-02-18 15:59:12 -05:00
|
|
|
for f in *.md
|
2022-02-16 00:53:01 -05:00
|
|
|
do
|
|
|
|
len=${#f}
|
|
|
|
base=${f:0:($len-3)}
|
|
|
|
if [ $f -nt $base.html ];
|
|
|
|
then
|
|
|
|
katex=""
|
|
|
|
for i in 1 2 3 4
|
|
|
|
do
|
2022-02-18 15:59:12 -05:00
|
|
|
read line
|
2022-02-16 00:53:01 -05:00
|
|
|
if [[ $line =~ katex ]];
|
2022-02-18 15:59:12 -05:00
|
|
|
then
|
|
|
|
katex=" --katex=./"
|
|
|
|
fi
|
2022-02-16 00:53:01 -05:00
|
|
|
done <$f
|
2022-02-22 01:56:03 -05:00
|
|
|
pandoc $katex $options $base.html $base.md
|
2022-02-16 00:53:01 -05:00
|
|
|
echo "$base.html from $f"
|
|
|
|
#else
|
|
|
|
# echo " $base.html up to date"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
cd ../..
|
2022-02-22 01:56:03 -05:00
|
|
|
templates=docs/pandoc_templates
|
2022-02-18 15:59:12 -05:00
|
|
|
for f in *.md
|
2022-02-16 00:53:01 -05:00
|
|
|
do
|
|
|
|
len=${#f}
|
|
|
|
base=${f:0:($len-3)}
|
|
|
|
if [ $f -nt $base.html ];
|
|
|
|
then
|
2022-02-22 01:56:03 -05:00
|
|
|
pandoc $osoptions --wrap=preserve --from markdown --to html --metadata=lang:en --standalone --css=$templates/style.css -o $base.html $base.md
|
2022-02-16 00:53:01 -05:00
|
|
|
echo "$base.html from $f"
|
|
|
|
#else
|
|
|
|
# echo " $base.html up to date"
|
|
|
|
fi
|
|
|
|
done
|