diff options
Diffstat (limited to '')
-rwxr-xr-x | aux/workflow/commonmark.sh | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/aux/workflow/commonmark.sh b/aux/workflow/commonmark.sh index b196867..6f5e59b 100755 --- a/aux/workflow/commonmark.sh +++ b/aux/workflow/commonmark.sh @@ -1,21 +1,15 @@ #!/bin/sh set -eu -while getopts 'N:o:r:w:L:' flag; do +while getopts 'N:t:l:' flag; do case "$flag" in N) PROJECT_UC="$OPTARG" ;; - o) - OUTDIR="$OPTARG" + t) + TITLE="$OPTARG" ;; - r) - IN_FILE="$OPTARG" - ;; - w) - OUT_FILE="$OPTARG" - ;; - L) + l) THE_LANG="$OPTARG" ;; *) @@ -33,25 +27,16 @@ assert_arg() { } assert_arg "${PROJECT_UC:-}" '-N PROJECT_UC' -assert_arg "${OUTDIR:-}" '-o OUTDIR' -assert_arg "${IN_FILE:-}" '-i IN_FILE' -assert_arg "${THE_LANG:-}" '-L THE_LANG' - -if [ -z "${OUT_FILE:-}" ]; then - OUT_FILE="${IN_FILE%.md}.html" -fi - -OUT="$OUTDIR/$OUT_FILE" -mkdir -p "$(dirname "$OUT")" +assert_arg "${TITLE:-}" '-t TITLE' +assert_arg "${THE_LANG:-}" '-l THE_LANG' pandoc \ - --toc \ - --highlight-style pygments \ - --toc-depth=2 \ - -s \ - --metadata title="$PROJECT_UC - ${IN_FILE%%.*}" \ - --metadata "lang=$THE_LANG" \ - -r commonmark \ - -w html \ - -H aux/workflow/favicon.html \ - < "$IN_FILE" > "$OUT" + --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 |