|
8 | 8 | authors: ("3MI Labs", "Aligned"), |
9 | 9 | version: "0.2", |
10 | 10 | summary: ( |
11 | | - ("logup.typ", [LogUp argument], <logup>), |
12 | | - ("memory.typ", [Memory argument], <memory>), |
13 | | - ("variables.typ", [Variables], <vars>), |
14 | | - ("signatures.typ", [Signatures], <signatures>), |
15 | | - ("is_bit.typ", [IS_BIT template], <isbit>), |
16 | | - ("sign.typ", [SIGN template], <sign>), |
17 | | - ("add.typ", [ADD/SUB template], <add>), |
18 | | - ("neg.typ", [NEG template], <neg>), |
19 | | - ("decode.typ", [DECODE table], <decode>), |
20 | | - ("cpu.typ", [CPU chip], <cpu>), |
21 | | - ("shift.typ", [SHIFT chip], <shift>), |
22 | | - ("branch.typ", [BRANCH chip], <branch>), |
23 | | - ("memw.typ", [MEMW chip], <memw>), |
24 | | - ("lt.typ", [LT chip], <lt>), |
25 | | - ("mul.typ", [MUL chip], <mul>), |
26 | | - ("dvrm.typ", [DVRM chip], <dvrm>), |
27 | | - ("load.typ", [LOAD chip], <load>), |
28 | | - ("ecall.typ", [ECALL chips], <ecall>), |
29 | | - ("bitwise.typ", [BITWISE chips], <bitwise>), |
| 11 | + ("PROOF SYSTEM", ( |
| 12 | + ("logup.typ", [LogUp argument], <logup>), |
| 13 | + ("memory.typ", [Memory argument], <memory>), |
| 14 | + )), |
| 15 | + ("OVERVIEW", ( |
| 16 | + ("variables.typ", [Variables], <vars>), |
| 17 | + ("signatures.typ", [Signatures], <signatures>), |
| 18 | + )), |
| 19 | + ("TEMPLATES", ( |
| 20 | + ("is_bit.typ", [IS_BIT template], <isbit>), |
| 21 | + ("sign.typ", [SIGN template], <sign>), |
| 22 | + ("add.typ", [ADD/SUB template], <add>), |
| 23 | + ("neg.typ", [NEG template], <neg>), |
| 24 | + )), |
| 25 | + ("MEMORY", ( |
| 26 | + ("memw.typ", [MEMW chip], <memw>), |
| 27 | + )), |
| 28 | + ("CPU", ( |
| 29 | + ("decode.typ", [DECODE table], <decode>), |
| 30 | + ("cpu.typ", [CPU chip], <cpu>), |
| 31 | + )), |
| 32 | + ("ALU", ( |
| 33 | + ("shift.typ", [SHIFT chip], <shift>), |
| 34 | + ("branch.typ", [BRANCH chip], <branch>), |
| 35 | + ("lt.typ", [LT chip], <lt>), |
| 36 | + ("mul.typ", [MUL chip], <mul>), |
| 37 | + ("dvrm.typ", [DVRM chip], <dvrm>), |
| 38 | + ("load.typ", [LOAD chip], <load>), |
| 39 | + ("bitwise.typ", [BITWISE chips], <bitwise>), |
| 40 | + )), |
| 41 | + ("ECALLS", ( |
| 42 | + ("about_ecalls.typ", [About ECALL], <ecall>), |
| 43 | + ("halt.typ", [HALT chip], <halt>), |
| 44 | + ("commit.typ", [COMMIT chip], <commit>), |
| 45 | + )) |
30 | 46 | ) |
31 | 47 | ) |
| 48 | +#let meta_sections = meta.summary.map(m => m.at(1)).sum() |
32 | 49 | #book-meta( |
33 | 50 | title: meta.title, |
34 | 51 | authors: meta.authors, |
35 | | - summary: prefix-chapter("front.typ", meta.title) + meta.summary.map(((ch, title, _ref)) => chapter(ch, title)).join() |
| 52 | + summary: prefix-chapter("front.typ", meta.title) |
| 53 | + + meta.summary.map( |
| 54 | + ((title, sections)) => { |
| 55 | + heading(depth: 1, title) + sections.map(((ch, title, _ref)) => chapter(ch, title)).join() |
| 56 | + } |
| 57 | + ).join() |
36 | 58 | ) |
37 | 59 |
|
38 | 60 | #let common-formatting(body) = { |
|
93 | 115 | #let xref(rf) = { |
94 | 116 | assert(is-shiroa, message: "xref should only be used when compiling for shiroa") |
95 | 117 | let lbl = rf.target |
96 | | - let found = meta.summary.find(((_, _, tag)) => str(lbl).starts-with(str(tag))) |
| 118 | + let found = meta_sections.find(((_, _, tag)) => str(lbl).starts-with(str(tag))) |
97 | 119 | context if found != none and found.at(0) != _toplevel.final() { |
98 | 120 | let (ch, title, ref) = found |
99 | 121 | if ref == lbl { |
100 | | - cross-link("/" + ch, [Chapter #(meta.summary.position(x => x == found) + 1)]) |
| 122 | + cross-link("/" + ch, [Chapter #(meta_sections.position(x => x == found) + 1)]) |
101 | 123 | } else { |
102 | 124 | // Because shiroa does weird url escaping |
103 | 125 | let shiroa-label = label(str(lbl).replace(":", "%3A")) |
|
130 | 152 | } |
131 | 153 |
|
132 | 154 | #let book-page(file, ..args) = { |
133 | | - let file = if file.ends-with(".typ") { |
134 | | - file |
135 | | - } else { |
136 | | - lower(file) + ".typ" |
| 155 | + if not file.ends-with(".typ") { |
| 156 | + file = lower(file) + ".typ" |
137 | 157 | } |
138 | | - assert(meta.summary.find(((f, _, _)) => f == file) != none, message: "Couldn't resolve typst source file " + file) |
| 158 | + |
| 159 | + assert(meta_sections.find(s => s.at(0) == file) != none, message: "Couldn't resolve typst source file " + file) |
| 160 | + |
139 | 161 | if is-shiroa { |
140 | 162 | (body) => { |
141 | 163 | show: common-formatting |
|
147 | 169 | } |
148 | 170 | }) |
149 | 171 | let cond() = _toplevel.final() == file |
150 | | - project.with(..args, title: context meta.summary.find(x => x.at(0) == _toplevel.final()).at(1), cond: cond)([ |
| 172 | + project.with(..args, title: context meta_sections.find(x => x.at(0) == _toplevel.final()).at(1), cond: cond)([ |
151 | 173 | #show ref: it => context if _toplevel.final() == file { |
152 | 174 | xref(it) |
153 | 175 | } |
|
0 commit comments