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-07-06 18:48:08 -04:00
|
|
|
templates=$(pwd)"/pandoc_templates"
|
|
|
|
options=$osoptions"--toc -N --toc-depth=5 --wrap=preserve --metadata=lang:en --include-in-header=icon.pandoc --include-before-body=$templates/before.pandoc --css=$templates/style.css -o"
|
|
|
|
pwd
|
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-07-06 18:48:08 -04:00
|
|
|
options=$osoptions"--toc -N --toc-depth=5 --wrap=preserve --metadata=lang:en --include-in-header=./icon.pandoc --include-before-body=$templates/before.pandoc --css=$templates/style.css --include-after-body=$templates/after.pandoc -o"
|
|
|
|
pwd
|
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-06-30 19:18:44 -04:00
|
|
|
echo "generating $base.html from $f"
|
|
|
|
pandoc $katex $options $base.html $base.md
|
2022-02-16 00:53:01 -05:00
|
|
|
#else
|
|
|
|
# echo " $base.html up to date"
|
|
|
|
fi
|
|
|
|
done
|
2022-05-30 23:59:04 -04:00
|
|
|
cd ..
|
|
|
|
cd names
|
2022-07-06 18:48:08 -04:00
|
|
|
options=$osoptions"--toc -N --toc-depth=5 --wrap=preserve --metadata=lang:en --include-in-header=./icon.pandoc --include-before-body=$templates/before.pandoc --css=$templates/style.css --include-after-body=$templates/after.pandoc -o"
|
|
|
|
pwd
|
2022-05-30 23:59:04 -04:00
|
|
|
for f in *.md
|
|
|
|
do
|
|
|
|
len=${#f}
|
|
|
|
base=${f:0:($len-3)}
|
|
|
|
if [ $f -nt $base.html ];
|
|
|
|
then
|
|
|
|
katex=""
|
|
|
|
for i in 1 2 3 4
|
|
|
|
do
|
|
|
|
read line
|
|
|
|
if [[ $line =~ katex ]];
|
|
|
|
then
|
|
|
|
katex=" --katex=./"
|
|
|
|
fi
|
|
|
|
done <$f
|
2022-06-30 19:18:44 -04:00
|
|
|
echo "generating $base.html from $f"
|
2022-05-30 23:59:04 -04:00
|
|
|
pandoc $katex $options $base.html $base.md
|
|
|
|
#else
|
|
|
|
# echo " $base.html up to date"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
cd ..
|
|
|
|
cd rootDocs
|
2022-07-06 18:48:08 -04:00
|
|
|
pwd
|
|
|
|
katex=""
|
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)}
|
2022-05-20 07:41:37 -04:00
|
|
|
if [ $f -nt ../../$base.html ];
|
2022-02-16 00:53:01 -05:00
|
|
|
then
|
2022-06-30 19:18:44 -04:00
|
|
|
echo "generating $base.html from $f"
|
2022-07-06 18:48:08 -04:00
|
|
|
pandoc $katex $options ../../$base.html $base.md
|
2022-05-20 07:41:37 -04:00
|
|
|
#--include-in-header=style.css
|
2022-02-16 00:53:01 -05:00
|
|
|
#else
|
|
|
|
# echo " $base.html up to date"
|
|
|
|
fi
|
|
|
|
done
|