#!/bin/bash # processing command line arguments # Define variables MATHJAX_URL='https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js' # Check commandline arguments if [ $# -lt 1 ] then RESEARCH_BUILD=`pwd`"/build" RESEARCH_TOPICS=`pwd` echo -e "No building directory was specified." elif [ $# -lt 2 ] then RESEARCH_BUILD="$1" RESEARCH_TOPICS=$RESEARCH_BUILD echo -e "No extra topics directory was specified." else RESEARCH_BUILD="$1" RESEARCH_TOPICS="$2" fi mkdir -p $RESEARCH_BUILD echo -e "Building into directory $RESEARCH_BUILD ..." echo -e "Using .md-files from $RESEARCH_TOPICS ..." # specify URL to avoid use of local library # see https://docs.mathjax.org/en/latest/web/start.html#ways-of-accessing-mathjax # and https://www.jsdelivr.com/package/npm/mathjax # create plain _research.html to be integrated into other files for f in $RESEARCH_TOPICS/*.md do filename=$(basename -- "$f") echo "Creating " $RESEARCH_BUILD/"${filename%.md}"_research.html " ..." pandoc $f -o $RESEARCH_BUILD/"${filename%.md}"_research.html \ --mathjax=$MATHJAX_URL \ -c css/base.css \ -c css/extra.css \ -c "css/print.css" \ -c "css/superfish.css" \ -c "css/superfish-vertical.css" \ -c "css/base_mode.css" done