aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--docs/gen/doc.m444
-rw-r--r--docs/gen/end.html2
-rw-r--r--docs/gen/start.m48
-rw-r--r--docs/gen/style.css55
-rw-r--r--docs/makefile27
-rw-r--r--docs/pva.md12
-rw-r--r--docs/pve.md13
8 files changed, 106 insertions, 59 deletions
diff --git a/.gitignore b/.gitignore
index a2ab9cd..32b66c5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,8 @@ confui/confui
# docs
docs/gen/paged.polyfill.js
-docs/gen/start.html
docs/*.html
+docs/*.toc
+docs/*.con
+docs/*.pdf
.obsidian
diff --git a/docs/gen/doc.m4 b/docs/gen/doc.m4
new file mode 100644
index 0000000..ec4c858
--- /dev/null
+++ b/docs/gen/doc.m4
@@ -0,0 +1,44 @@
+define(`docname',
+ ifelse(NAME, `pva', `Plan van aanpak',
+ NAME, `pve', `Pakket van eisen',
+ `UNKNOWN???'))dnl
+
+<!DOCTYPE html>
+<html lang="en-US">
+<link>
+ <meta charset="utf-8">
+ <style>undivert(`gen/style.css')</style>
+ <script>undivert(`gen/paged.polyfill.js')</script>
+ `<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;
+ }
+
+ item.setAttribute("heading-num-fix", heading.substr(0, heading.length - 1));
+ });
+ }
+ </script>'
+</head>
+<body>
+ <div class="docintro">
+ <span class="left">
+ docname()<br/>
+ Project Domotica<br/>
+ esyscmd(`LANG="en_US.utf8" date "+%B %d, %Y"')
+ </span>
+ <span class="right">
+ Joshua Regnier <b>(2183008)</b><br/>
+ Loek Le Blansch <b>(2180996)</b><br/>
+ Niels Stunnebrink <b>(2184532)</b>
+ </span>
+ </div>
+ <h1>Table of contents</h1>
+ undivert(NAME`.toc')
+ undivert(NAME`.con')
+</body>
+</html>
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 @@
-</body>
-</html>
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 @@
-<!DOCTYPE html>
-<html>
-<link>
- <meta charset='utf-8'>
- <style>include(`style.css')</style>
- <script defer src="./gen/paged.polyfill.js"></script>
-</head>
-<body>
diff --git a/docs/gen/style.css b/docs/gen/style.css
index 601cbc6..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 {
@@ -46,19 +54,40 @@
border-bottom: 1pt solid black;
}
- .docintro p {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- margin: 0;
- }
+ .docintro {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ margin: 0;
+ }
+
+ .docintro .left,
+ .docintro .right {
+ display: block;
+ }
- .docintro .left,
- .docintro .right {
- display: block;
- }
+ .docintro .right {
+ text-align: right;
+ }
- .docintro .right {
- text-align: right;
- }
+ .pagebr {
+ break-before: page;
+ }
+
+ nav ol {
+ counter-reset: item;
+ list-style-type: none;
+ }
+
+ nav li {
+ position: relative;
+ counter-increment: item;
+ }
+
+ nav li::before {
+ position: absolute;
+ transform: translateX(-100%) translateX(-5pt);
+ left: 0;
+ content: attr(heading-num-fix);
+ }
}
diff --git a/docs/makefile b/docs/makefile
index 9a994e4..78a931a 100644
--- a/docs/makefile
+++ b/docs/makefile
@@ -1,27 +1,32 @@
PANDOC = pandoc
-CAT = cat
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)
-all: $(HTML_T)
+.PRECIOUS: %.toc %.con
+
+all: $(PDF_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 $< > $@
+%.con: %.md
+ $(PANDOC) $< --to=html > $@
+
+%.toc: %.md
+ $(PANDOC) $< -s --toc --to=html 2> /dev/null | $(PUP) '#TOC' | sed -r 's/<(.?)ul>/<\1ol>/g' > $@
-%.html: %.md gen/start.html gen/paged.polyfill.js
- $(PANDOC) $< --to=html | $(CAT) gen/start.html - gen/end.html > $@
+%.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
+ $(CHROME) --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
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
-<div class="docintro">
- <span class="left">
- Plan van aanpak<br/>
- Project Domotica
- </span>
- <span class="right">
- Joshua Regnier <b>(2183008)</b><br/>
- Loek Le Blansch <b>(2180996)</b><br/>
- Niels Stunnebrink <b>(2184532)</b>
- </span>
-</div>
-
# 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 @@
-<div class="docintro">
- <span class="left">
- Pakket van eisen<br/>
- Project Domotica
- </span>
- <span class="right">
- Joshua Regnier <b>(2183008)</b><br/>
- Loek Le Blansch <b>(2180996)</b><br/>
- Niels Stunnebrink <b>(2184532)</b>
- </span>
-</div>
-
# Introduction
+
node = one node that contains both a button and a LED
SE = self explanatory