diff options
Diffstat (limited to 'docs/makefile')
-rw-r--r-- | docs/makefile | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/docs/makefile b/docs/makefile index 9a994e4..843716a 100644 --- a/docs/makefile +++ b/docs/makefile @@ -4,11 +4,14 @@ M4 = m4 RM = rm -f CHROME = chromium CURL = curl +PUP = pup SRCS = $(wildcard *.md) HTML_T = $(patsubst %.md,%.html, $(SRCS)) PDF_T = $(patsubst %.md,%.pdf, $(SRCS)) +.PRECIOUS: %.toc + all: $(HTML_T) gen/paged.polyfill.js: @@ -17,8 +20,11 @@ gen/paged.polyfill.js: gen/start.html: gen/start.m4 gen/style.css $(M4) -I gen $< > $@ -%.html: %.md gen/start.html gen/paged.polyfill.js - $(PANDOC) $< --to=html | $(CAT) gen/start.html - gen/end.html > $@ +%.html: %.md %.toc gen/start.html gen/paged.polyfill.js + $(PANDOC) $< --to=html | $(CAT) gen/start.html $(word 2,$^) - gen/end.html > $@ + +%.toc: %.md + $(PANDOC) $< -s --toc --to=html 2> /dev/null | $(PUP) '#TOC' | sed -r 's/<(.?)ul>/<\1ol>/g' > $@ %.pdf: %.html $(CHROME) --headless --print-to-pdf=$@ $< 2> /dev/null |