aboutsummaryrefslogtreecommitdiff
path: root/aux/workflow/commonmark.sh
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2022-01-18 11:40:47 -0300
committerEuAndreh <eu@euandre.org>2022-01-18 14:02:59 -0300
commit47bfd2ed8c3219e79f8974a8fc2ac9265ed91bd2 (patch)
tree3d162596d874b4f775da12c843ad3918b593f713 /aux/workflow/commonmark.sh
parentInitial empty commit (diff)
downloadtd-47bfd2ed8c3219e79f8974a8fc2ac9265ed91bd2.tar.gz
td-47bfd2ed8c3219e79f8974a8fc2ac9265ed91bd2.tar.xz
First commit, now with a clean history
Diffstat (limited to 'aux/workflow/commonmark.sh')
-rwxr-xr-xaux/workflow/commonmark.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/aux/workflow/commonmark.sh b/aux/workflow/commonmark.sh
new file mode 100755
index 0000000..088d447
--- /dev/null
+++ b/aux/workflow/commonmark.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+set -eu
+
+while getopts 'N:t:l:H:' flag; do
+ case "$flag" in
+ N)
+ PROJECT_UC="$OPTARG"
+ ;;
+ t)
+ TITLE="$OPTARG"
+ ;;
+ l)
+ THE_LANG="$OPTARG"
+ ;;
+ H)
+ ALTERNATES="$OPTARG"
+ ;;
+ *)
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+assert_arg() {
+ if [ -z "$1" ]; then
+ echo "Missing $2" >&2
+ exit 2
+ fi
+}
+
+assert_arg "${PROJECT_UC:-}" '-N PROJECT_UC'
+assert_arg "${TITLE:-}" '-t TITLE'
+assert_arg "${THE_LANG:-}" '-l THE_LANG'
+assert_arg "${ALTERNATES:-}" '-H ALTERNATES'
+
+pandoc \
+ --toc \
+ --highlight-style pygments \
+ --toc-depth=2 \
+ -s \
+ --metadata title="$PROJECT_UC - $TITLE" \
+ --metadata "lang=$THE_LANG" \
+ -r commonmark \
+ -w html \
+ -H aux/workflow/favicon.html \
+ -H aux/workflow/style.css \
+ -H "$ALTERNATES"