Skip to content

A MathML type selector is written as its name (quire#1178) - #107

Merged
moshez merged 1 commit into
mainfrom
worker/quire-1178
Nov 30, 2026
Merged

moshez merged 1 commit into
mainfrom
worker/quire-1178

Conversation

@moshez

@moshez moshez commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Fixes #108

Head: 19f8baa

Route decision (quire#1178, written by research)

Problem: a book's math{font-family} never reaches an equation, so quire#1179's default math font cannot be beaten by the book's own.

Routes:

  1. Math elements become book elements (dom makes them with data-book-element, css and the reader follow). Bridge's op 14 already takes a math: tag, but dom's book_tag has none, so it needs a new dom function, a relock chain css, dom, quire, and in layout 1 the reader's [data-book-element]:not(code,...){font-family:inherit!important} would then override both the book's face and the default, so that rule needs a :not(math) too. Largest change, most places to be wrong.
  2. Map the book's math face in quire (as data-align is, _align_mark): quire would parse the sheet's math font-family itself and map it to the generated face names, which only css knows. A second reader of the same sheet and a copy of css's face mapping: not the owning layer.
  3. The css walk writes a MathML type selector as its name (this PR). css is the layer that decides what a rule may match; its scope is the container's prefix, which already limits a selector to the chapter's own elements. A type selector matches in any namespace, so [data-book-container="c1"] math{...} matches dom's math element. The face mapping, the layer order (reader-base under book) and the reader's rules stay as they are; dom needs only a relock (its add_book_sheet calls book_sheet_pieces), quire a relock and the spec.

Chosen: 3. Overlap rule (repository-prototype's CLAUDE.md): no signature or type changes, so no dependent fails to check and the verify rule is met; the old output matched only a div or span named like a MathML element, which no book makes, so the old form is not kept beside it (stated in CLAUDE.md, keyword math-type). Known limits, written there too: a class or id on a MathML element is not matched (the reader sets class, not data-book-class), and the nth-child ... of :where([data-book-element]) counts skip them.

Plan

  • _w_math_name in _w_type: the names of dom's _math_element_ok are written as themselves (lower case).
  • Goldens of the two Typst fixtures updated (their mtable, mtd, mtr, math selectors); four new tests.

Execution

$ bats check --repository /home/user/repository-prototype
check passed (library)
$ bats test --repository /home/user/repository-prototype
running 125 native test(s)
all tests passed

Mutation: with src/book.bats stashed (the old walk) the run fails test_fixture_typst_reflow, test_fixture_typst_fixed, test_math_type_font_family, test_math_type_book_face and test_math_type_descendant_and_not; test_math_type_html_name_stays_scoped passes both ways (it guards the other names).

Evidence

CI's check is the evidence for the dynamic tests (tests/dynamic/run.sh, none of which names a MathML selector: grep -rn mtable tests is empty).


Generated by Claude Code

…pe, quire#1178)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HwLsLqnBm3u7Rwk8pezYB3
@moshez
moshez merged commit 462acd8 into main Nov 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A MathML type selector is written as its name (quire#1178)

2 participants