diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-11-18 14:48:58 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-11-18 14:48:58 +0100 |
commit | e47b1ddefa9989594bb81bd872b88c085cd777bc (patch) | |
tree | 288cee427d326814766a0f54a56601dfe1b6dffd /docs | |
parent | a1b15467c49cea4080898b970cbc90e4fd4a32fd (diff) |
WIP table of contents
Diffstat (limited to 'docs')
-rw-r--r-- | docs/gen/style.css | 47 | ||||
-rw-r--r-- | docs/makefile | 10 |
2 files changed, 42 insertions, 15 deletions
diff --git a/docs/gen/style.css b/docs/gen/style.css index 601cbc6..fe107da 100644 --- a/docs/gen/style.css +++ b/docs/gen/style.css @@ -46,19 +46,40 @@ border-bottom: 1pt solid black; } - .docintro p { - display: flex; - flex-direction: row; - justify-content: space-between; - margin: 0; - } + .docintro p { + display: flex; + flex-direction: row; + justify-content: space-between; + margin: 0; + } + + .docintro .left, + .docintro .right { + display: block; + } + + .docintro .right { + text-align: right; + } - .docintro .left, - .docintro .right { - display: block; - } + .pagebr { + break-before: page; + } + + ol { + counter-reset: item; + } - .docintro .right { - text-align: right; - } + li { + display: block; + position: relative; + } + + li::before { + position: absolute; + left: 0; + content: counters(item, ".") " "; + transform: translateX(-100%) translateX(-5pt); + counter-increment: item; + } } 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 |