#!/bin/bash

mkdir -p pdf
mkdir -p html

pandoc -o pdf/NOTES_ON_OPTICAL_PRINTER_TECHNIQUE.pdf -f markdown+implicit_figures NOTES_ON_OPTICAL_PRINTER_TECHNIQUE.md

MARKDOWN="$(cat NOTES_ON_OPTICAL_PRINTER_TECHNIQUE.md)"
HTML_TMP=$(mktemp -d)

SVG="${MARKDOWN//.jpg/.svg}"
SVG="${SVG//img\//..\/img\/}"

echo "${SVG}" > "${HTML_TMP}/index.md"

pandoc --css=style.css -o html/index.html -t html -f markdown+implicit_figures "${HTML_TMP}/index.md"

rm -r "${HTML_TMP}"