#!/bin/sh set -eu TLD="$(cat aux/tld.txt)" PROJECT_UC= while getopts 'n:N:m:o:' flag; do case "$flag" in n) PROJECT="$OPTARG" ;; N) PROJECT_UC="$OPTARG" ;; m) MAILING_LIST="$OPTARG" ;; o) OUTDIR="$OPTARG" ;; *) exit 2 ;; esac done shift $((OPTIND - 1)) assert_arg() { if [ -z "$1" ]; then echo "Missing $2" >&2 exit 2 fi } assert_arg "${PROJECT:-}" '-n PROJECT' assert_arg "${MAILING_LIST:-}" '-m MAILING_LIST' assert_arg "${OUTDIR:-}" '-o OUTDIR' if [ -z "${PROJECT_UC:-}" ]; then PROJECT_UC="$PROJECT" fi # shellcheck disable=1004 IDS_REGEX='s:^## \(TODO\|DOING\|WAITING\|MEETING\|INACTIVE\|NEXT\|CANCELLED\|DONE\|WONTFIX\) \(.*\) {#\(.*\)}\(.*\)$:## \1 \2\4\
#\3
\ :g' TAGS_REGEX='s|tag:\([a-z0-9-]*\)|\1|g' cat aux/workflow/preamble.md TODOs.md | sed \ -e "s:@PROJECT_UC@:$PROJECT_UC:g" \ -e "s:@PROJECT@:$PROJECT:g" \ -e "s:@MAILING_LIST@:$MAILING_LIST:g" \ -e "s:@TLD@:$TLD:g" \ -e "$IDS_REGEX" \ -e "$TAGS_REGEX" | pandoc \ --toc \ --highlight-style pygments \ --toc-depth=2 \ -s \ --metadata title="$PROJECT_UC - TODOs" \ --metadata lang=en \ -r commonmark \ -w html \ -H aux/workflow/favicon.html \ -H aux/workflow/style.css | sed \ -e 's:::g' \ > "$OUTDIR/TODOs.html"