aboutsummaryrefslogtreecommitdiff
path: root/aux/workflow/TODOs.sh
blob: d84e6f7fb2b07ee00728f74cbad7c55fab5371d6 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
set -eu

mkdir -p public

PROJECT_UC="$1"
PROJECT="$2"
MAILING_LIST="$3"

TODOS_REGEX='s/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE) (.*) \{#(.*?)\}$/## <a href="#\3"><span class="\1">\1<\/span> \2<\/a>\n<span class="header-anchor" id="\3">#\3<\/span>\n/'

TAGS_REGEX='s/tag:([\w-]+)/<span class="tag">\1<\/span>/g'

SED_REGEX="s:@PROJECT_UC@:$PROJECT_UC:g"

sed -e "s:@PROJECT_UC@:$PROJECT_UC:g" \
    -e "s:@PROJECT@:$PROJECT:g" \
    -e "s:@MAILING_LIST@:$MAILING_LIST:g" < aux/workflow/preamble.md | \
  printf '%s\n\n%s' \
         "$(cat -)" \
         "$(perl -pe "$TODOS_REGEX" TODOs.md | \
              perl -pe "$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/style.css              \
         > public/TODOs.html