aboutsummaryrefslogtreecommitdiffstats
path: root/lib/outline-minutes
diff options
context:
space:
mode:
authorGustav Eek <gustav.eek@fripost.org>2024-07-14 09:56:48 +0200
committerGustav Eek <gustav.eek@fripost.org>2024-07-15 11:34:45 +0200
commit6ca5b89bb9ca44fde227a67ec5de403a660149fc (patch)
treec6fce06f8197e0b98770d967b9406ce1360e4250 /lib/outline-minutes
parent7c7ea5ae027c0f0b353aef54749b34957cf05c59 (diff)
System. Create a minute outline script and add exerption
The *outline-minutes* script generates a minute outline from an agenda. This commit contains the script, a Make target and minute template files (markdown and yaml). Also add a minute excrption from encrypted markdown to Makefile
Diffstat (limited to 'lib/outline-minutes')
-rwxr-xr-xlib/outline-minutes50
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/outline-minutes b/lib/outline-minutes
new file mode 100755
index 0000000..dee37ef
--- /dev/null
+++ b/lib/outline-minutes
@@ -0,0 +1,50 @@
+#!/usr/bin/env bash
+
+HELP="Usage: outline-minutes [-h] [-t TEMPLATE] [SRC [TRG]]
+
+Generate a minute outline from an agenda read from file.
+
+Optional arguments
+ SRC File basename of agenda source (default 'agenda')
+ TRG File basename of minute target (default 'minutes')
+
+Parameters
+ -t TEMPLATE Use this minute template
+ -h help
+
+The agenda body is assumed to be a Pandoc markdown numbered list. The list items are simply converted to headlines. The *date* meta data is extracted. The script looks for SRC.md and SRC.yml and produces TRG.md and TRG.yml.
+
+NOTE. Altering of source, target and template is not yet implemented. These options are ignored
+"
+
+SRC=agenda
+TRG=minutes
+
+if [ "$1" == "-h" ]; then echo "$HELP"; exit; fi
+if [ -n "$1" ]; then echo "{0##*/}: Arguments not implemented. See `${0} -h`." 1>^2; exit 1; fi
+
+dir=$(dirname "$0")
+tmpl="${dir}/tmpl/${TRG}"
+body="${XDG_RUNTIME_DIR}/${0##*/}.md"
+
+# Create metadata output
+
+date=$(cat "$SRC.yml" | grep -m1 '^date:' | cut -d: -f2)
+title=$(cat "$SRC.yml" | grep -m1 '^title:' | cut -d: -f2 |
+ sed 's/[dD]agordning//; s/[fF]örslag//;' )
+
+cat "$tmpl.yml" \
+ | sed -e "s/[$]date[$]/${date}/" \
+ -e "s/[$]title[$]/${title}/" \
+ > "$TRG.yml"
+
+# Create body output
+
+cat "$SRC.md" | pandoc -f markdown -t markdown \
+ | sed -e "s/^[0-9]*\. */\n\n\n# /" \
+ -e "s/^ \( *[0-9]*\.\)/\1/" \
+ > "$body"
+
+cat "$tmpl.md" \
+ | sed -e "/[$]body[$]/ r ${body}" -e "/[$]body[$]/ d" \
+ > "$TRG.md"