Files
Vijay Janapa Reddi 7fcf6abd61 refactor(scripts): rename fix_cross_references.py → resolve_cross_references.py and add Principle xref resolver
Reframe the post-render script as a designed resolution step of the
website-mode pipeline rather than a "fix" for broken output. Extend it
to handle the previously-unresolved `Principle \ref{pri-X}` pattern:
Pandoc parses bare `\ref{}` as inline math, MathJax renders the
undefined label as `???`, leaving Principle ??? leaks in the HTML.

Pattern 4 detects `<span class="math inline">\(\ref{pri-X}\)</span>`
and substitutes the resolved `Principle N` link by replaying the
per-volume principle-callout count across parts/*_principles.qmd in
declared order. Cross-volume independent numbering.

Supporting changes:
- Add a Math handler to the custom-numbered-blocks Lua filter as a
  conceptually-correct sibling to the existing RawInline handler.
  Benign no-op cross-file (data isn't populated); lights up
  automatically if the principles file is ever in the same Pandoc
  invocation as the chapter that references it.
- Propagate the rename to epub_postprocess.py import, verify_rendered_xrefs.py
  doc strings, scripts/README.md, and validate.py mention.
- Rename function fix_cross_references → resolve_cross_references.
2026-05-18 21:24:15 -07:00

18 KiB