aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2019-11-02 21:07:14 +0100
committerJonas Smedegaard <dr@jones.dk>2019-11-02 21:07:14 +0100
commit82db9d928f13073932d7f035a19da933fcc5d9fa (patch)
tree41fc384d52c9b381bfd3173e27b259138e71dcc2
parent0d6f39f58f912add8448541cff118d750cc3beb8 (diff)
Process mustache templating.
-rw-r--r--Makefile28
1 files changed, 22 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index d358ec3..cd21f72 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,20 @@
-# Depends: myrepos git mkdocs linkchecker
+# Depends: myrepos git mkdocs linkchecker libtext-hogan-perl
+
+domain ?= example.org
+shellhost ?= shell.$(domain)
+githost ?= source.$(domain)
+gitshellhost ?= $(shellhost)
+matrixhost ?= matrix.$(domain)
+organisation ?= Example orga
+contact_sysadmins ?= contact sysadmins
+
+MUSTACHE = cat source/source/USE.md | perl -MText::Hogan::Compiler -0777 -nE '\
+ my $$compiler = Text::Hogan::Compiler->new;\
+ my $$template = $$compiler->compile($$_);\
+ say $$template->render({ \
+ domain => "$(domain)", shellhost => "$(shellhost)", githost => "$(githost)", gitshellhost => "$(gitshellhost)", \
+ matrixhost => "$(matrixhost)", \
+ organisation => "$(organisation)", contact_sysadmins => "$(contact_sysadmins)" })'
all: doc
@@ -14,15 +30,15 @@ docs:
docs/%: source
mkdir -p docs/$*
- ln -sf $(shell realpath --relative-to=$@ source/$(subst /,-,$*)/README.md) docs/$*/index.md
+ $(MUSTACHE) < source/$(subst /,-,$*)/README.md > docs/$*/index.md
$(if $(wildcard source/$(subst /,-,$*)/USE.md),\
- ln -sf $(shell realpath --relative-to=$@ source/$(subst /,-,$*)/USE.md) docs/$*/use.md)
+ $(MUSTACHE) < source/$(subst /,-,$*)/USE.md > docs/$*/use.md)
$(if $(wildcard source/$(subst /,-,$*)/ADMIN.md),\
- ln -sf $(shell realpath --relative-to=$@ source/$(subst /,-,$*)/ADMIN.md) docs/$*/admin.md)
+ $(MUSTACHE) < source/$(subst /,-,$*)/ADMIN.md > docs/$*/admin.md)
$(if $(wildcard source/$(subst /,-,$*)/SETUP.md),\
- ln -sf $(shell realpath --relative-to=$@ source/$(subst /,-,$*)/SETUP.md) docs/$*/setup.md)
+ $(MUSTACHE) < source/$(subst /,-,$*)/SETUP.md > docs/$*/setup.md)
$(if $(wildcard source/$(subst /,-,$*)/DEVELOP.md),\
- ln -sf $(shell realpath --relative-to=$@ source/$(subst /,-,$*)/DEVELOP.md) docs/$*/devel.md)
+ $(MUSTACHE) < source/$(subst /,-,$*)/DEVELOP.md > docs/$*/devel.md)
init:
mr update