diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-11-19 17:50:39 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-11-19 17:50:39 +0100 |
commit | 27ef32dd82d69d2c8cdcae96cab713696399a281 (patch) | |
tree | 3cc134946b6d4e804b40a3062acbc1e27d52c8ef | |
parent | e4966d5a01ef5aef24527fb713232d152f057fef (diff) |
small cleanup + fix pdf output of makefile
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | docs/gen/doc.m4 | 29 | ||||
-rw-r--r-- | docs/makefile | 10 |
3 files changed, 17 insertions, 23 deletions
@@ -16,4 +16,5 @@ docs/gen/paged.polyfill.js docs/*.html docs/*.toc docs/*.con +docs/*.pdf .obsidian diff --git a/docs/gen/doc.m4 b/docs/gen/doc.m4 index d049d0f..ec4c858 100644 --- a/docs/gen/doc.m4 +++ b/docs/gen/doc.m4 @@ -9,26 +9,19 @@ define(`docname', <meta charset="utf-8"> <style>undivert(`gen/style.css')</style> <script>undivert(`gen/paged.polyfill.js')</script> - `<script> - class HeadingNumFix extends Paged.Handler { - constructor(chunker, polisher, caller) { - super(chunker, polisher, caller); - } + `<script defer> + window.onload = function() { + document.querySelectorAll("nav li").forEach(item => { + var heading = ""; + var parent = item; + for (parent = item; parent.nodeName != "NAV"; parent = parent.parentNode) { + if (parent.nodeName != "LI") continue; + heading = parent.getAttribute("data-item-num") + "." + heading; + } - afterRendered(_) { - document.querySelectorAll("nav li").forEach(item => { - var heading = ""; - var parent = item; - for (parent = item; parent.nodeName != "NAV"; parent = parent.parentNode) { - if (parent.nodeName != "LI") continue; - heading = parent.getAttribute("data-item-num") + "." + heading; - } - - item.setAttribute("heading-num-fix", heading.substr(0, heading.length - 1)); - }); - } + item.setAttribute("heading-num-fix", heading.substr(0, heading.length - 1)); + }); } - Paged.registerHandlers(HeadingNumFix); </script>' </head> <body> diff --git a/docs/makefile b/docs/makefile index b5917af..78a931a 100644 --- a/docs/makefile +++ b/docs/makefile @@ -1,17 +1,17 @@ PANDOC = pandoc M4 = m4 RM = rm -f -CHROME = chromium +CHROME = chromium --headless --run-all-compositor-stages-before-draw --virtual-time-budget=10000 --print-to-pdf-no-header CURL = curl PUP = pup SRCS = $(wildcard *.md) -HTML_T = $(patsubst %.md,%.html, $(SRCS)) -PDF_T = $(patsubst %.md,%.pdf, $(SRCS)) +HTML_T = $(SRCS:.md=.html) +PDF_T = $(SRCS:.md=.pdf) .PRECIOUS: %.toc %.con -all: $(HTML_T) +all: $(PDF_T) gen/paged.polyfill.js: $(CURL) -Ls https://unpkg.com/pagedjs/dist/paged.polyfill.js > $@ @@ -26,7 +26,7 @@ gen/paged.polyfill.js: $(M4) -DNAME=$(basename $<) gen/doc.m4 > $@ %.pdf: %.html - $(CHROME) --headless --print-to-pdf=$@ $< 2> /dev/null + $(CHROME) --print-to-pdf=$@ $< 2> /dev/null clean: $(RM) $(HTML_T) $(PDF_T) *.toc *.con gen/paged.polyfill.js |