From e1c3b0a1f5ebc64da3d783b0b37c9441c47ca79b Mon Sep 17 00:00:00 2001
From: EuAndreh <eu@euandre.org>
Date: Sat, 23 Jan 2021 19:37:24 -0300
Subject: Add default workflow infrastructure

---
 build-aux/workflow/README.sh   | 29 +++++++++++++++++++++++++++++
 build-aux/workflow/TODOs.sh    | 23 +++++++++++++++++++++++
 build-aux/workflow/preamble.md | 16 ++++++++++++++++
 build-aux/workflow/style.css   | 38 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 106 insertions(+)
 create mode 100755 build-aux/workflow/README.sh
 create mode 100755 build-aux/workflow/TODOs.sh
 create mode 100644 build-aux/workflow/preamble.md
 create mode 100644 build-aux/workflow/style.css

(limited to 'build-aux')

diff --git a/build-aux/workflow/README.sh b/build-aux/workflow/README.sh
new file mode 100755
index 0000000..1aa2593
--- /dev/null
+++ b/build-aux/workflow/README.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+set -eu
+
+mkdir -p public
+
+PROJECT_UC="$1"
+PROJECT="$2"
+
+RELEASES_LIST="$(mktemp)"
+for version in $(git tag); do
+  echo "- version [$version](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$version.tar.gz), released in $(git log -1 --format=%cd --date=short "$version")" >> "$RELEASES_LIST"
+done
+
+RELEASES="$(mktemp)"
+if [ -s "$RELEASES_LIST" ]; then
+  printf '# Releases\n\n' >> "$RELEASES"
+  cat "$RELEASES_LIST" >> "$RELEASES"
+fi
+
+cat README.md "$RELEASES" | \
+  pandoc --toc                                  \
+         --highlight-style pygments             \
+         --toc-depth=2                          \
+         -s                                     \
+         --metadata title="$PROJECT_UC - TODOs" \
+         --metadata lang=en                     \
+         -r markdown                            \
+         -w html                                \
+         > public/index.html
diff --git a/build-aux/workflow/TODOs.sh b/build-aux/workflow/TODOs.sh
new file mode 100755
index 0000000..3f9fa4b
--- /dev/null
+++ b/build-aux/workflow/TODOs.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+set -eu
+
+mkdir -p public
+
+export PROJECT_UC="$1"
+export PROJECT="$2"
+export MAILING_LIST="$3"
+
+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/'
+
+envsubst < build-aux/workflow/preamble.md                      | \
+  printf '%s\n\n%s' "$(cat -)" "$(perl -pe "$REGEX" TODOs.md)" | \
+  pandoc --toc                                  \
+         --highlight-style pygments             \
+         --toc-depth=2                          \
+         -s                                     \
+         --metadata title="$PROJECT_UC - TODOs" \
+         --metadata lang=en                     \
+         -r markdown                            \
+         -w html                                \
+         -H build-aux/workflow/style.css        \
+         > public/TODOs.html
diff --git a/build-aux/workflow/preamble.md b/build-aux/workflow/preamble.md
new file mode 100644
index 0000000..c6ae56e
--- /dev/null
+++ b/build-aux/workflow/preamble.md
@@ -0,0 +1,16 @@
+# About
+
+TODOs for $PROJECT_UC.
+
+See also [$PROJECT.euandreh.xyz](https://$PROJECT.euandreh.xyz/).
+
+Register a new one at
+[~euandreh/$MAILING_LIST@lists.sr.ht](mailto:~euandreh/$MAILING_LIST@lists.sr.ht?subject=%5B$PROJECT%5D%20BUG%20or%20TASK%3A%20%3Cdescription%3E)
+and see [existing discussions](https://lists.sr.ht/~euandreh/$MAILING_LIST?search=%5B$PROJECT%5D).
+
+*Você também pode escrever em português*.
+
+*Vous pouvez aussi écrire en français*.
+
+*Vi povas ankaŭ skribi esperante*.
+
diff --git a/build-aux/workflow/style.css b/build-aux/workflow/style.css
new file mode 100644
index 0000000..ac0144c
--- /dev/null
+++ b/build-aux/workflow/style.css
@@ -0,0 +1,38 @@
+<style>
+  hr {
+    background-color: #ccc;
+  }
+
+  span.header-anchor {
+    opacity: 0.5;
+  }
+
+  /*
+    Replicate colors from:
+    https://git.euandreh.xyz/dotfiles/tree/spacemacs.el?id=fcd9f9c4ef399d45d54927382dc1cdde251ebb0a#n866
+  */
+
+  .TODO {
+    color: brown;
+  }
+
+  .DOING {
+    color: yellowgreen;
+  }
+
+  .WAITING, .MEETING {
+    color: gray;
+  }
+
+  .INACTIVE {
+    color: orange;
+  }
+
+  .NEXT {
+    color: red;
+  }
+
+  .CANCELLED, .DONE {
+    color: green;
+  }
+</style>
-- 
cgit v1.2.3