diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-04-20 00:03:16 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-04-20 00:03:16 +0200 |
| commit | 8692dba921531783b9204a9323db2aba640fe978 (patch) | |
| tree | 57f9f2f5bb1d72f050a2a89234db762aa4cba733 /repo/www/Makefile | |
| parent | 3a18562cad4b0fb144b637037ee676bafaaa3632 (diff) | |
| download | memory-leaks-8692dba921531783b9204a9323db2aba640fe978.tar.xz | |
Parse site title from top-level README
Maybe not the best idea, since the dependency chain will trigger a
site-wide rebuild everytime the README is edited. Ah well.
Diffstat (limited to 'repo/www/Makefile')
| -rw-r--r-- | repo/www/Makefile | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/repo/www/Makefile b/repo/www/Makefile index fb933c8..c236936 100644 --- a/repo/www/Makefile +++ b/repo/www/Makefile @@ -1,24 +1,27 @@ TOP_DIR = ../.. OUT_DIR = $(TOP_DIR)/public TEXT_FILES = md org -# make does not care about unpaired single quotes (nor double quotes -# for that matter) but Emacs does. Shell out. -TITLE = $(shell echo "peniblec's memleaks") dirname = $(patsubst %/,%,$(dir $(1))) dirnames = $(sort $(call dirname,$(1))) text_patterns = $(foreach ext,$(TEXT_FILES),'$(TOP_DIR)/**.$(ext)') text_folders = $(call dirnames,$(shell git ls-files $(text_patterns))) +top_readme = $(shell git ls-files $(addprefix $(TOP_DIR)/README.,$(TEXT_FILES))) all: site cache = .cache +# Site title, parsed from the top-level README. +title = $(cache)/title # Maps folders to their contents (files and subfolders). site_tree = $(cache)/site-tree.json # Defines $(pages) and $(indices). dependencies = $(cache)/deps.mk +$(title): $(top_readme) | $(cache) + pandoc --lua-filter print-title.lua $< > $@ + $(site_tree): $(text_folders) | $(cache) ./generate-tree.py -o $@ $(TEXT_FILES) @@ -37,13 +40,15 @@ html_folders = $(call dirnames,$(pages) $(indices)) $(html_folders) $(cache): mkdir -p $@ +$(pages) $(indices): $(title) + $(pages): $(OUT_DIR)/%.html: - pandoc -s $< -o $@ -T "$(TITLE)" -M title="$*" + pandoc -s $< -o $@ -T "$$(cat $(title))" -M title="$*" # ⚠ When tweaking this rule, check whether it still works for the # top-level index.html. $(indices): $(OUT_DIR)/%index.html: - ./generate-index.py $(site_tree) "$(TITLE)" "$(patsubst %/,%,$*)" $@ + ./generate-index.py $(site_tree) "$$(cat $(title))" "$(patsubst %/,%,$*)" $@ clean: -rm $(dependencies) |
