diff options
-rw-r--r-- | lib/Makefile | 27 | ||||
-rwxr-xr-x | lib/outline-minutes | 50 | ||||
-rw-r--r-- | lib/tmpl/minutes.md | 17 | ||||
-rw-r--r-- | lib/tmpl/minutes.yml | 3 |
4 files changed, 97 insertions, 0 deletions
diff --git a/lib/Makefile b/lib/Makefile index 2c53bed..3a4e046 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -7,6 +7,7 @@ SLIDES ?= # will be compiled with beamer MINUTES ?= # will be compiled with *minutes* template POLICY ?= # will be compiled with *by-laws* template REPORTS ?= # will be compiled with *report* template +EXCERPTS ?= # will be compiled with *minutes* template from encrypted source # Repository root @@ -21,6 +22,8 @@ ALL ?= \ $(addsuffix .pdf, $(POLICY)) \ $(addsuffix .pdf, $(MINUTES)) \ $(addsuffix .pdf, $(REPORTS)) \ + $(addsuffix .pdf, $(EXCERPTS)) \ + all: $(ALL) @@ -47,6 +50,25 @@ $(addsuffix .pdf, $(REPORTS)): %.pdf: %.md $$(test -f $*.yml && echo --metadata-file=$*.yml) \ -o $@ $*.md +# Compile encrypted minute excerpt + +$(addsuffix .pdf, $(EXCERPTS)): %.pdf: %.md.gpg + gpg -d < $< | \ + pandoc -f markdown -t latex \ + --template=fripost-minutes \ + -o $@ + +# Refresh markdown if YAML meta data files are touched + +.PHONY: refresh + +YML := $(basename $(wildcard *.yml)) + +refresh: $(addsuffix .md, $(YML)) + +%.md: %.yml + touch -r $< $@ + # Archive .PHONY: archive @@ -80,6 +102,11 @@ send: @echo; echo Now avialable as; \ for f in $(SEND); do echo " - https://fripost.org/minutes/$$f"; done +# Generate a minute outline from an agenda + +outline-minutes: + $(ROOT)/lib/outline-minutes + # Clean .PHONY: clean 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" diff --git a/lib/tmpl/minutes.md b/lib/tmpl/minutes.md new file mode 100644 index 0000000..6dc6094 --- /dev/null +++ b/lib/tmpl/minutes.md @@ -0,0 +1,17 @@ +Tid och plats + +: + +Deltagare + +: + + +$body$ + + +```{=latex} +\signatureline{ , mötessekreterare} +\hfill +\signatureline{ , justeringsperson} +``` diff --git a/lib/tmpl/minutes.yml b/lib/tmpl/minutes.yml new file mode 100644 index 0000000..0737c05 --- /dev/null +++ b/lib/tmpl/minutes.yml @@ -0,0 +1,3 @@ +title: $title$ +author: Fripost +date: $date$ |