From e47b1ddefa9989594bb81bd872b88c085cd777bc Mon Sep 17 00:00:00 2001 From: lonkaars Date: Fri, 18 Nov 2022 14:48:58 +0100 Subject: WIP table of contents --- .gitignore | 1 + docs/gen/style.css | 47 ++++++++++++++++++++++++++++++++++------------- docs/makefile | 10 ++++++++-- 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index a2ab9cd..69ffee4 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,5 @@ confui/confui docs/gen/paged.polyfill.js docs/gen/start.html docs/*.html +docs/*.toc .obsidian 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 -- cgit v1.2.3 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 From e52d0d34a3e30bfda68b3e3deb383c7e47ffe682 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sat, 19 Nov 2022 12:53:13 +0100 Subject: more better document generation --- docs/gen/doc.m4 | 20 +++++++++++++++++++- docs/gen/style.css | 8 ++++---- docs/pva.md | 12 ------------ docs/pve.md | 13 +------------ 4 files changed, 24 insertions(+), 29 deletions(-) diff --git a/docs/gen/doc.m4 b/docs/gen/doc.m4 index 3ad8009..fe1c408 100644 --- a/docs/gen/doc.m4 +++ b/docs/gen/doc.m4 @@ -1,11 +1,29 @@ +define(`docname', + ifelse(NAME, `pva', `Plan van aanpak', + NAME, `pve', `Pakket van eisen', + `UNKNOWN???'))dnl + - + +
+ + docname()
+ Project Domotica
+ esyscmd(`LANG="en_US.utf8" date "+%B %d, %Y"') +
+ + Joshua Regnier (2183008)
+ Loek Le Blansch (2180996)
+ Niels Stunnebrink (2184532) +
+
+

Table of contents

undivert(NAME`.toc') undivert(NAME`.con') diff --git a/docs/gen/style.css b/docs/gen/style.css index fe107da..ac5c18a 100644 --- a/docs/gen/style.css +++ b/docs/gen/style.css @@ -46,7 +46,7 @@ border-bottom: 1pt solid black; } - .docintro p { + .docintro { display: flex; flex-direction: row; justify-content: space-between; @@ -66,16 +66,16 @@ break-before: page; } - ol { + #TOC ol { counter-reset: item; } - li { + #TOC li { display: block; position: relative; } - li::before { + #TOC li::before { position: absolute; left: 0; content: counters(item, ".") " "; diff --git a/docs/pva.md b/docs/pva.md index c089e37..3524c5e 100644 --- a/docs/pva.md +++ b/docs/pva.md @@ -1,17 +1,5 @@ [Trello]: https://trello.com/b/LSiYzM8C/casadomotica -
- - Plan van aanpak
- Project Domotica -
- - Joshua Regnier (2183008)
- Loek Le Blansch (2180996)
- Niels Stunnebrink (2184532) -
-
- # Backgrounds ## Project diff --git a/docs/pve.md b/docs/pve.md index 7d41b99..48daca4 100644 --- a/docs/pve.md +++ b/docs/pve.md @@ -1,16 +1,5 @@ -
- - Pakket van eisen
- Project Domotica -
- - Joshua Regnier (2183008)
- Loek Le Blansch (2180996)
- Niels Stunnebrink (2184532) -
-
- # Introduction + node = one node that contains both a button and a LED SE = self explanatory -- cgit v1.2.3 From e4966d5a01ef5aef24527fb713232d152f057fef Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sat, 19 Nov 2022 15:31:59 +0100 Subject: fix table of contents numbering and add hyphenation --- docs/gen/doc.m4 | 23 ++++++++++++++++++++++- docs/gen/style.css | 22 +++++++++++++++------- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/docs/gen/doc.m4 b/docs/gen/doc.m4 index fe1c408..d049d0f 100644 --- a/docs/gen/doc.m4 +++ b/docs/gen/doc.m4 @@ -4,11 +4,32 @@ define(`docname', `UNKNOWN???'))dnl - + + `'
diff --git a/docs/gen/style.css b/docs/gen/style.css index ac5c18a..7474846 100644 --- a/docs/gen/style.css +++ b/docs/gen/style.css @@ -7,6 +7,7 @@ content: counter(page); } } + html, body { width: 100%; margin: 0; @@ -17,6 +18,12 @@ font-size: 11pt; } + a { + text-decoration: none; + color: unset; + font-style: italic; + } + pre, code { font-family: "JetBrainsMono Nerd Font"; font-size: 9pt; @@ -29,6 +36,7 @@ figcaption, p { text-align: justify; text-justify: auto; + hyphens: auto; } table { @@ -66,20 +74,20 @@ break-before: page; } - #TOC ol { + nav ol { counter-reset: item; + list-style-type: none; } - #TOC li { - display: block; + nav li { position: relative; + counter-increment: item; } - #TOC li::before { + nav li::before { position: absolute; - left: 0; - content: counters(item, ".") " "; transform: translateX(-100%) translateX(-5pt); - counter-increment: item; + left: 0; + content: attr(heading-num-fix); } } -- cgit v1.2.3 From 27ef32dd82d69d2c8cdcae96cab713696399a281 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sat, 19 Nov 2022 17:50:39 +0100 Subject: small cleanup + fix pdf output of makefile --- .gitignore | 1 + docs/gen/doc.m4 | 29 +++++++++++------------------ docs/makefile | 10 +++++----- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index 6a47ef4..32b66c5 100644 --- a/.gitignore +++ b/.gitignore @@ -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', - `' 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 -- cgit v1.2.3