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 options=$osoptions"--toc --number-sections --toc-depth=5 --from markdown+smart+raw_html+native_divs+native_spans+fenced_divs+bracketed_spans --to html5 --wrap=preserve --metadata=lang:en --include-in-header=icon.pandoc --css=$templates/style.css -o" for f in *.md do len=${#f} base=${f:0:($len-3)} if [ $f -nt $destdir$base.html ]; then line="" for i in 1 2 3 4 5 6 do read line if [[ $line =~ katex$ ]]; then katex=" --katex=./" fi done <$f pandoc $katex $options $destdir$base.html $base.md echo "$base.html from $f" #else # echo " $base.html up to date" fi done