oxedyne/fe2o3/fe2o3_austenite/tests/oracle/fixtures/context_fixture.typ
2.3 KiB, 1 run
created by r1870400018:58113, which is this file's identity for as long as the history lasts, whatever it is later renamed to
download · who wrote it · its history
| 1 | // The oracle harness's `#context{ ... }` brace-form fixture -- the regression root for the bug found by |
| 2 | // adversarial QA of the Lucronics book: a line-leading `#context { ... }` code-block call (the brace twin |
| 3 | // of `#context[ ... ]`) was set VERBATIM as body text, leaking ~300 lines of source as prose in ch29.8. |
| 4 | // The reader now recognises and refuses the brace form the same way it refuses the bracket form, so the |
| 5 | // block never survives into the rendered output. Deliberately self-contained: no `#import` of any shared |
| 6 | // template, so it depends on nothing this crate does not own and needs no symbol-modifier patch (see |
| 7 | // `mod.rs`'s `prepare_patched_template_mirror`) to compile under typst 0.15.1. |
| 8 | // |
| 9 | // The `#context` block below binds locals and iterates without emitting any content, so Typst evaluates |
| 10 | // it to nothing and Austenite refuses-and-drops it: the two engines' pages agree. A regression that |
| 11 | // re-leaked the block would set its source lines as extra paragraphs, moving the pinned PDF hash and the |
| 12 | // heading pages that the oracle order-matches against Typst. The real ch29.8 block DOES emit a reverse |
| 13 | // index; there, evaluating it (generating that back-matter index) is a separate scheduled feature, and |
| 14 | // this fix only stops the leak -- the section renders absent-but-reported, not garbled. |
| 15 | #let doc(body, heading-font: "Libertinus Serif") = body |
| 16 | #show: doc.with(heading-font: "Libertinus Serif") |
| 17 | |
| 18 | = A Context Leak Fixture |
| 19 | |
| 20 | This paragraph precedes the context block, and is written long enough to wrap onto more than one line so |
| 21 | the page carries real body text the raster sample can land on rather than a single short line where a |
| 22 | regression might hide. |
| 23 | |
| 24 | #context { |
| 25 | let claim-refs = ("c1", "c2", "c3", "c4") |
| 26 | let by-code = (:) |
| 27 | for r in claim-refs { |
| 28 | if r in by-code { |
| 29 | by-code.insert(r, by-code.at(r) + 1) |
| 30 | } else { |
| 31 | by-code.insert(r, 1) |
| 32 | } |
| 33 | } |
| 34 | let codes = by-code.keys().sorted() |
| 35 | let total = codes.len() |
| 36 | } |
| 37 | |
| 38 | This paragraph follows the context block. Both engines set exactly these two paragraphs and nothing |
| 39 | between them: Austenite refuses and drops the block, and Typst evaluates it to no content, so the body is |
| 40 | identical either way. |
| 41 | |
| 42 | == A Second Heading |
| 43 | |
| 44 | A second short section, so the fixture carries more than one heading for the oracle's order-matched |
| 45 | anchor-page comparison to line up against. |