Oregami
Repositories/oxedyne/fe2o3

oxedyne/fe2o3/fe2o3_austenite/tests/oracle/fixtures/media_fixture/root.typ

1.9 KiB, 1 run

created by r1870400018:58119, 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 `#if media`-guarded include fixture -- the regression root for the bug found by
2// adversarial QA of the elearnity books: the assembler reached a chapter's `#if media == "ebook" [ ... ]
3// else [ ... ]` guard, followed BOTH branches, and printed the `#if ...[`, `] else [` and `]` marker
4// lines as prose. Five books' Sources chapters (CheapThinking, UpsideDown, TheMarbleMachine, Oxpecker,
5// TheGoldenSwan) doubled their back matter this way. The assembler now evaluates the guard and follows
6// only the taken branch, dropping the other and its marker lines.
7//
8// `media` is bound in this root's own `#let` (a real book binds it in `config.typ` and the chapter reads
9// `#import "config.typ": media`; the guard evaluator resolves the scalar from the config first, then from
10// the guard's own file, so both answer). With `media == "ebook"` the ebook branch is taken: only
11// `ebook_sources.typ` renders, `print_sources.typ` is dropped, and no `#if`/`else`/`]` line appears. A
12// regression that followed both branches would set the print heading and its paragraph too, and the raw
13// marker lines as prose -- moving the pinned PDF hash and the heading pages the oracle order-matches
14// against Typst, which follows exactly the same one branch. Self-contained: no shared-template import,
15// no `config.typ` (the doc idiom), so it needs no symbol-modifier patch to compile under typst 0.15.1.
16#set page(width: 595.276pt, height: 841.89pt, margin: 56.9pt)
17#set text(size: 11pt, font: "Libertinus Serif")
18#set par(justify: true, leading: 0.65em, spacing: 1.2em, first-line-indent: 0pt)
19
20#let media = "ebook"
21
22= Sources and Notes
23
24This chapter draws its source list from the edition being built. The `media` guard below selects the
25full ebook source set and drops the condensed print set, so exactly one of the two branches reaches the
26page in either engine.
27
28#if media == "ebook" [
29 #include "ebook_sources.typ"
30] else [
31 #include "print_sources.typ"
32]