2023-08-25 17:45:47 -04:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
cd `dirname $0`
|
|
|
|
docroot="../"
|
2023-09-18 23:13:07 -04:00
|
|
|
targetDocroot="docs/"
|
2023-08-25 17:45:47 -04:00
|
|
|
destdir="../../"
|
2023-09-18 23:13:07 -04:00
|
|
|
banner_height=banner_height:15ex
|
|
|
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
|
|
osoptions=""
|
|
|
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
osoptions=""
|
|
|
|
elif [[ "$OSTYPE" == "cygwin" ]]; then
|
|
|
|
osoptions="--fail-if-warnings --eol=lf "
|
|
|
|
elif [[ "$OSTYPE" == "msys" ]]; then
|
|
|
|
osoptions="--fail-if-warnings --eol=lf "
|
|
|
|
fi
|
|
|
|
if [[ -z $targetDocroot ]]; then
|
|
|
|
targetDocroot=$docroot
|
|
|
|
fi
|
2023-09-19 01:54:05 -04:00
|
|
|
options=$osoptions"--toc --number-sections --toc-depth=5 --from markdown+smart+raw_html+fenced_divs+bracketed_spans --to html5 --wrap=preserve --metadata=lang:en --css=$targetDocroot/pandoc_templates/style.css -Bnavbar -o"
|
2023-09-18 23:13:07 -04:00
|
|
|
for f in *
|
|
|
|
do
|
|
|
|
[[ -d $item && -x $item/mkdocs.sh ]] && $item/mkdocs.sh
|
|
|
|
if [[ $f =~ (.*)".md"$ ]];then
|
|
|
|
base=${BASH_REMATCH[1]}
|
|
|
|
if [[ $f -nt $destdir$base.html ]]; then
|
|
|
|
katex=""
|
|
|
|
line=""
|
|
|
|
for i in 1 2 3 4 5 6
|
|
|
|
do
|
|
|
|
read line
|
|
|
|
|
|
|
|
if [[ $line =~ katex ]];then
|
|
|
|
katex=" --katex="$docroot
|
|
|
|
fi
|
|
|
|
done <$f
|
2023-09-19 01:54:05 -04:00
|
|
|
pandoc --variable $banner_height --variable targetDocroot:$targetDocroot --template $docroot"pandoc_templates/pandoc.template" $katex $options $destdir$base.html $base.md
|
2023-09-18 23:13:07 -04:00
|
|
|
echo "$destdir$base.html from $f"
|
|
|
|
#else
|
|
|
|
# echo " $base.html up to date"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|