diff --git a/common.typ b/common.typ index 7b44694..6e8c494 100644 --- a/common.typ +++ b/common.typ @@ -211,22 +211,28 @@ } #let table-of-contents() = { - html-style(class:"table-of-contents", "", [ - #box( + html-style(class:"table-of-contents", "", box( stroke: black, radius: 2pt, inset: 3%, - )[ - Table of contents\ - #context { - let idx = state("stupid-gen-page-state", 0); - gen-tree-from-headings(query(heading), + [Table of contents\ + #let idx = state("stupid-gen-page-state", 0); + + #context gen-tree-from-headings(query(heading), elemfn: (content, x) => { - [#content #context html-span((class:"headingr",id:"headingr-"+str(idx.get())), link(x.location(), x.body)) #context idx.update(x=> x + 1) #br()] + [ + #html-opt-elem("p", (style:"line-height:1.1"))[ + #html-style("display:flex; text-indent:0pt;")[ + #html-style("margin-right: 11pt;", content) + #html-style("flex:1;")[ + #context html-span((class:"headingr",id:"headingr-"+str(idx.get())), link(x.location(), x.body)) + #context idx.update(x=> x + 1) + ] + ] + ] + ] }) - } - ] - #html-script-dom-onload(" + ])) + html-style(class:"table-of-contents", "", html-script-dom-onload(" let tags = ['h2','h3','h4'].flatMap(x => Array.from(document.getElementsByTagName(x))); document.getElementById('headingr-0').classList.add('current') document.addEventListener('scroll', (event) => { @@ -235,8 +241,7 @@ Array.from(document.getElementsByClassName('headingr')).map(x => x.classList.remove('current')) document.getElementById('headingr-'+idx).classList.add('current') }); - ") - ] + [ + ") + [ #context if is-html() { html.elem("style", " .table-of-contents > p > span { width: 100%; } diff --git a/pages/compiler-pattern-matching.typ b/pages/compiler-pattern-matching.typ index 07d230b..5a05fa9 100644 --- a/pages/compiler-pattern-matching.typ +++ b/pages/compiler-pattern-matching.typ @@ -106,7 +106,7 @@ - they are easier and nicer to use and read than manual pattern matching in the compiler's source code. \ - There is however a even better alternative: + There is however an even better alternative: ] #section[ diff --git a/pages/index.typ b/pages/index.typ index 0e56b93..5491ed3 100644 --- a/pages/index.typ +++ b/pages/index.typ @@ -42,6 +42,7 @@ #tree-list( (level:1, body: [ Making a simple RegEx engine ]), (level:2, body: html-href("article-make-regex-engine-1.typ.desktop.html")[ Part 1: Introduction to RegEx ]), + (level:1, body: html-href("compiler-pattern-matching.typ.desktop.html")[ Compiler Pattern Matching ]), ) #br()