#!/usr/bin/env bash pandoc_to_pdf () { #VARIABLES="--filter pandoc-codeblock-include --filter pandoc-crossref --filter pandoc-imagine"; VARIABLES="$VARIABLES --variable papersize=a4paper"; VARIABLES="$VARIABLES --table-of-contents"; VARIABLES="$VARIABLES --number-sections"; VARIABLES="$VARIABLES --variable links-as-notes=true"; VARIABLES="$VARIABLES --highlight-style=pygments"; if test "$1" == ""; then echo you must supply an input!; else if test "$2" == ""; then echo you must supply an output!; else source="$1"; shift; dest="$1"; shift; pandoc "$source" --pdf-engine="xelatex" $VARIABLES "$@" -o "$dest"; fi; fi } ( cat header.md curl "http://www.pvv.ntnu.no/w/index.php?title=Halv%C3%A5rsm%C3%B8te/2019H&action=raw" | pandoc -f mediawiki -t gfm cat footer.md ) > out.md pandoc_to_pdf out.md out.pdf rm out.md echo written to out.pdf