From 0db6d0616bd4a9730b68e22f29fc76232981cc88 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sat, 19 Nov 2022 12:38:09 +0100 Subject: more WIP doc generation --- .gitignore | 2 +- docs/gen/doc.m4 | 12 ++++++++++++ docs/gen/end.html | 2 -- docs/gen/start.m4 | 8 -------- docs/makefile | 15 +++++++-------- 5 files changed, 20 insertions(+), 19 deletions(-) create mode 100644 docs/gen/doc.m4 delete mode 100644 docs/gen/end.html delete mode 100644 docs/gen/start.m4 diff --git a/.gitignore b/.gitignore index 69ffee4..6a47ef4 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,7 @@ confui/confui # docs docs/gen/paged.polyfill.js -docs/gen/start.html docs/*.html docs/*.toc +docs/*.con .obsidian diff --git a/docs/gen/doc.m4 b/docs/gen/doc.m4 new file mode 100644 index 0000000..3ad8009 --- /dev/null +++ b/docs/gen/doc.m4 @@ -0,0 +1,12 @@ + + + + + + + + + undivert(NAME`.toc') + undivert(NAME`.con') + + diff --git a/docs/gen/end.html b/docs/gen/end.html deleted file mode 100644 index 308b1d0..0000000 --- a/docs/gen/end.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/docs/gen/start.m4 b/docs/gen/start.m4 deleted file mode 100644 index f714588..0000000 --- a/docs/gen/start.m4 +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/docs/makefile b/docs/makefile index 843716a..b5917af 100644 --- a/docs/makefile +++ b/docs/makefile @@ -1,5 +1,4 @@ PANDOC = pandoc -CAT = cat M4 = m4 RM = rm -f CHROME = chromium @@ -10,24 +9,24 @@ SRCS = $(wildcard *.md) HTML_T = $(patsubst %.md,%.html, $(SRCS)) PDF_T = $(patsubst %.md,%.pdf, $(SRCS)) -.PRECIOUS: %.toc +.PRECIOUS: %.toc %.con all: $(HTML_T) gen/paged.polyfill.js: $(CURL) -Ls https://unpkg.com/pagedjs/dist/paged.polyfill.js > $@ -gen/start.html: gen/start.m4 gen/style.css - $(M4) -I gen $< > $@ - -%.html: %.md %.toc gen/start.html gen/paged.polyfill.js - $(PANDOC) $< --to=html | $(CAT) gen/start.html $(word 2,$^) - gen/end.html > $@ +%.con: %.md + $(PANDOC) $< --to=html > $@ %.toc: %.md $(PANDOC) $< -s --toc --to=html 2> /dev/null | $(PUP) '#TOC' | sed -r 's/<(.?)ul>/<\1ol>/g' > $@ +%.html: %.con %.toc gen/doc.m4 gen/paged.polyfill.js gen/style.css + $(M4) -DNAME=$(basename $<) gen/doc.m4 > $@ + %.pdf: %.html $(CHROME) --headless --print-to-pdf=$@ $< 2> /dev/null clean: - $(RM) $(HTML_T) $(PDF_T) gen/start.html gen/paged.polyfill.js + $(RM) $(HTML_T) $(PDF_T) *.toc *.con gen/paged.polyfill.js -- cgit v1.2.3