From 6ca5b89bb9ca44fde227a67ec5de403a660149fc Mon Sep 17 00:00:00 2001 From: Gustav Eek Date: Sun, 14 Jul 2024 09:56:48 +0200 Subject: 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 --- lib/outline-minutes | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 lib/outline-minutes (limited to 'lib/outline-minutes') 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" -- cgit v1.2.3