1
0
forked from javalsai/website
javalsais-website/notes/make-views.sh
2024-09-30 22:26:29 +02:00

19 lines
539 B
Bash
Executable File

#!/usr/bin/env bash
set -e;
MYSELF=$(realpath "$0");
MYDIR=$(dirname "$MYSELF");
PRE_IMPORT=${PRE_IMPORT:-/components/md-pre.html}
POST_IMPORT=${POST_IMPORT:-/components/md-post.html}
find "${1-$MYDIR}" -iname '*.md' | while read -r line; do
# target=${line//\.md/.html}
target=$(sed 's/\.md$/\.html/' <<< "$line")
echo "$line -> $target";
echo "<!--# include virtual=\"$PRE_IMPORT\" -->" > "$target"
pandoc --mathml "$line" -o - >> "$target"
echo "<!--# include virtual=\"$POST_IMPORT\" -->" >> "$target"
done