From 82db9d928f13073932d7f035a19da933fcc5d9fa Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sat, 2 Nov 2019 21:07:14 +0100 Subject: Process mustache templating. --- Makefile | 28 ++++++++++++++++++++++------ 1 file 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 -- cgit v1.2.3