diff options
author | Jonas Smedegaard <dr@jones.dk> | 2020-02-28 01:00:33 +0100 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2020-02-28 01:00:33 +0100 |
commit | fa37ff161d4292650d9c2d21e1a780ff81879e01 (patch) | |
tree | 76d2ab240c17250686db5493ad61b42da2af4e07 /Makefile | |
parent | 138e04629e4a99bde4fe805758e2cdc8ca4f2c67 (diff) |
set page title from initial header line
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -5,6 +5,8 @@ hypertext = $(subst index/index,index,$(markdown:%.mdwn=%/index.html)) graph := $(wildcard *.dot */*.dot */*/*.dot) vectorimage-graph := $(graph:%.dot=%.svg) +sitetitle := $(shell head --lines=1 index.mdwn | grep --perl-regexp --only-matching '^\#\s*\K(\S+(\s\S+)*)+') + compass_plugins = h5bp all: $(hypertext) $(vectorimage-graph) style.css @@ -21,8 +23,9 @@ $(vectorimage-graph): %.svg: %.dot Makefile dot -Tsvg -o$@ $< %.html %/index.html: %.mdwn $(hypertext-snippets) Makefile + $(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 -c $(shell realpath --relative-to=$(dir $@) style.css) -B topbar.html -A footer.html -f commonmark -t html -o $@ $< + 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 commonmark -t html -o $@ $< %.css : %.scss Makefile # scss --compass --style compressed $< $@ |