summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2022-03-26 12:01:45 +0100
committerJonas Smedegaard <dr@jones.dk>2022-03-26 12:14:22 +0100
commitbcde570f8588d5c9359e4a2b50580baafed902bd (patch)
tree24e571ca874150caf2f8ea898defdaeab0f2487d
parente050e0f72c1275c686e8f857177c6a5b3fdb93a0 (diff)
wrap long lines in make script, and strip excess whitespace from titles
-rw-r--r--Makefile16
1 files changed, 13 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index a101059..f728e45 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,8 @@ hypertext = $(subst index/index,index,$(markdown:%.md=%/index.html))
graph := $(wildcard *.dot */*.dot */*/*.dot)
vectorimage-graph := $(graph:%.dot=%.svg)
-sitetitle := $(shell head --lines=1 index.md | grep --perl-regexp --only-matching '^\#\s*\K(\S+(\s\S+)*)+')
+sitetitle := $(shell head --lines=1 index.md \
+ | grep --perl-regexp --only-matching '^\#\s*\K(\S+(\s\S+)*)+')
all: $(hypertext) $(vectorimage-graph) style.css
@@ -21,9 +22,18 @@ $(vectorimage-graph): %.svg: %.dot Makefile
dot -Tsvg -o$@ $<
%.html %/index.html: %.md $(hypertext-snippets) Makefile
- $(eval title = $(shell head --lines=1 $< | grep --perl-regexp --only-matching '^\#\s*\K(\S+(\s\S+)*)+'))
+ $(eval title = $(shell head --lines=1 $< \
+ | grep --perl-regexp --only-matching '^\#\s*\K(\S+(\s\S+)*)+'))
$(if $(filter-out ./,$(dir $@)),mkdir -p $(dir $@))
- pandoc -s $(if $(title),--metadata pagetitle='$(if $(filter-out $(sitetitle),$(title)),$(sitetitle) -- )$(title)') -c $(shell realpath --relative-to=$(dir $@) style.css) -B topbar.html -A footer.html -f markdown -t html -o $@ $<
+ pandoc -f markdown -t html -s \
+ $(if $(title),\
+ $(if $(filter-out $(sitetitle),$(title)),$(strip \
+ --metadata pagetitle='$(sitetitle) -- $(title)'),$(strip \
+ --metadata pagetitle='$(title)'))) \
+ -c $(shell realpath --relative-to=$(dir $@) style.css) \
+ -B topbar.html \
+ -A footer.html \
+ -o $@ $<
%.css : %.scss Makefile
sassc --load-path /usr/share/sass --style compressed $< $@