1
0
forked from cheng/wallet
wallet/docs/mkdocs.sh

144 lines
3.3 KiB
Bash
Raw Normal View History

#!/bin/bash
set -e
echo `dirname $0`
cd `dirname $0`
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
2022-07-06 18:48:08 -04:00
templates=$(pwd)"/pandoc_templates"
options=$osoptions"--toc -N --toc-depth=5 --from markdown+smart --wrap=preserve --metadata=lang:en --include-in-header=icon.pandoc --include-before-body=$templates/before.pandoc --css=$templates/style.css -o"
2022-07-06 18:48:08 -04:00
pwd
for f in *.md
do
len=${#f}
base=${f:0:($len-3)}
if [ $f -nt $base.html ];
then
katex=""
mine="--include-after-body=$templates/after.pandoc "
for i in 1 2 3 4 5 6
do
read line
if [[ $line =~ katex$ ]];
then
katex=" --katex=./"
fi
if [[ $line =~ notmine ]];
then
mine=" "
fi
done <$f
pandoc $katex $mine $options $base.html $base.md
echo "$base.html from $f"
#else
# echo " $base.html up to date"
fi
done
cd libraries
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"
2022-07-06 18:48:08 -04:00
pwd
for f in *.md
do
len=${#f}
base=${f:0:($len-3)}
if [ $f -nt $base.html ];
then
mine="--include-after-body=$templates/after.pandoc "
katex=""
for i in 1 2 3 4
do
read line
if [[ $line =~ katex ]];
then
katex=" --katex=./"
fi
if [[ $line =~ notmine ]];
then
mine=" "
fi
done <$f
echo "generating $base.html from $f"
pandoc $katex $mine $options $base.html $base.md
#else
# echo " $base.html up to date"
fi
done
cd ..
cd names
options=$osoptions"--toc -N --toc-depth=5 --from markdown+smart --wrap=preserve --metadata=lang:en --include-in-header=./icon.pandoc --include-before-body=$templates/before.pandoc --css=$templates/style.css -o"
2022-07-06 18:48:08 -04:00
pwd
for f in *.md
do
len=${#f}
base=${f:0:($len-3)}
if [ $f -nt $base.html ];
then
mine="--include-after-body=$templates/after.pandoc "
katex=""
for i in 1 2 3 4
do
read line
if [[ $line =~ katex ]];
then
katex=" --katex=./"
fi
if [[ $line =~ notmine ]];
then
mine=" "
fi
done <$f
echo "generating $base.html from $f"
pandoc $katex $mine $options $base.html $base.md
fi
done
cd ..
cd setup
options=$osoptions"--toc -N --toc-depth=5 --from markdown+smart --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
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
echo "generating $base.html from $f"
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=""
for f in *.md
do
len=${#f}
base=${f:0:($len-3)}
if [ $f -nt ../../$base.html ];
then
echo "generating $base.html from $f"
2022-07-06 18:48:08 -04:00
pandoc $katex $options ../../$base.html $base.md
#--include-in-header=style.css
#else
# echo " $base.html up to date"
fi
done