diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-11-19 15:31:59 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-11-19 15:31:59 +0100 |
commit | e4966d5a01ef5aef24527fb713232d152f057fef (patch) | |
tree | 83984afe64d6bafb892221dd9e422c4c7bae58e9 | |
parent | e52d0d34a3e30bfda68b3e3deb383c7e47ffe682 (diff) |
fix table of contents numbering and add hyphenation
-rw-r--r-- | docs/gen/doc.m4 | 23 | ||||
-rw-r--r-- | 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 <!DOCTYPE html> -<html> +<html lang="en-US"> <link> <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); + } + + 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)); + }); + } + } + Paged.registerHandlers(HeadingNumFix); + </script>' </head> <body> <div class="docintro"> 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); } } |