fix(typst-book): localize orange-book running header when lang is set#14525
fix(typst-book): localize orange-book running header when lang is set#14525cderv wants to merge 7 commits into
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
This is the right fix! But currently it needs to be made on: https://github.com/quarto-ext/orange-book Then once it’s on main on that repo, run to update the subtree. Modifying it directly will “work”, but only until the next time that repo is updated. (And won’t help anyone who might have forked that repo for their own changes.) It’s debatable whether that repo needs to be a subtree extension instead of fully built-in. My rationale is that it is somewhat independent of Quarto; could get forked; we could switch to another fork or another extension. Glad to discuss. https://github.com/quarto-dev/quarto-cli/blob/main/dev-docs/subtree-extensions.md For that matter it’s also possible to push your changes back to the repo with |
|
How did I forgot !! 🤦 We discussed it. Sorry for this and thanks for the reminder. |
|
You’ll also find that you can’t rebase the subtree & will get weird path errors if you try. So you’ll need to merge the branch without rebasing. (The complexity has to go somewhere I guess. Subtrees are still less confusing than submodules IMO.) |
Surfaces crossref-ch-prefix, crossref-lof-title, and crossref-lot-title from format.language into Pandoc YAML metadata so they resolve in the orange-book typst-show.typ template. Adds a small surfaceParamToMeta helper in common/meta.lua for reuse by future channel-2b localized template vars. The supplement-chapter parameter on book.with(...) drives the running header via a show heading rule; without the meta surfacing it defaulted to the English literal "Chapter" regardless of lang. The existing list-of-figure-title and list-of-table-title pipes in the same template were affected by the same gap and silently rendered as empty strings. Fixes #14524
Maps the full lang: → rendered output pipeline across HTML, LaTeX/PDF, and Typst. Documents the three downstream surfaces from format.language (Lua filter params, explicit format.metadata copies in pandoc.ts, direct TS reads in HTML extras) and the design split between crossref: block (per-document overrides) and language: block (translations) per the crossref schema.
Adds a path-scoped .claude/rules/ guard so files under src/resources/extension-subtrees/ surface a "do not edit directly" warning when touched. Fleshes out dev-docs/subtree-extensions.md with explicit "Updating an extension" and "Recovery" sections covering the rare in-tree-edit case.
… 9f786e1b4..b11e50490 b11e50490 Merge pull request #3 from quarto-ext/fix/localize-running-header 77a306cb0 Forward crossref-ch-prefix to book() for localized running header git-subtree-dir: src/resources/extension-subtrees/orange-book git-subtree-split: b11e50490d1b802c919e85bf94e1fb9d20977611
…ge-book-typst-running-header-lang
439af28 to
add83ea
Compare
|
So now I understand how it works, and it is a nice way to externalize some work, and have monorepo + external repo. Anyway, I did quarto-ext/orange-book#3 and then rebase the branch to edit change before calling dev-call command. It should be good. |
|
I don't like the way those language var are exposed. So I think want to make a deeper feature fix by leveraging newest |
When rendering a Typst book with
lang:set to a non-English locale, the orange-book running header keeps the EnglishChapter N.prefix instead of the locale's word (e.g.Chapitre N.forlang: fr).Root cause
The orange-book
book(...)exposes asupplement-chapterparameter (default"Chapter") consumed by ashow heading.where(level: 1): set heading(supplement: ...)rule that drives the running header. The Quarto-sidetypst-show.typnever passed this parameter tobook.with(...), so the English default applied regardless oflang:.The localized value lives in
format.language["crossref-ch-prefix"](loaded from_language-<lang>.yml).languageFilterParamsexposes it to Lua filter params, but no code wrote it into Pandoc YAML metadata where the$crossref-ch-prefix$template variable would resolve.The same gap affected the existing
list-of-figure-titleandlist-of-table-titlepipes in the same template — they silently rendered as empty strings when the user enabledlof: true/lot: true.Fix
crossref/meta.luanow surfacescrossref-ch-prefix,crossref-lof-title, andcrossref-lot-titlefrom filter params into Pandoc metadata via a newsurfaceParamToMeta(meta, key)helper incommon/meta.lua. The orange-booktypst-show.typgains a gatedsupplement-chapter: "$crossref-ch-prefix$"pipe; the two list-title pipes start working as a side effect.The template change landed upstream in quarto-ext/orange-book#3 and arrives in this branch via
quarto dev-call pull-git-subtree orange-book(the squash + merge commits at the tip). The pipe is gated on$if(crossref-ch-prefix)$...$endif$so older Quarto versions or non-Quarto consumers of the template fall back tobook()'s own defaultChapter.User precedence is preserved:
surfaceParamToMetaonly writes whenmeta[key]is unset, so explicit metadata wins.Documentation
A new
llm-docs/localization-architecture.mdmaps the full localization pipeline across HTML, LaTeX/PDF, and Typst, and documents the design split betweencrossref:block (per-document overrides for a subset of keys) andlanguage:block (translations for the full set, includingcrossref-ch-prefix/crossref-apx-prefix).Two further doc additions, discovered during review, codify the subtree workflow for future contributors:
.claude/rules/extension-subtrees.md— path-scoped rule loaded when editing files undersrc/resources/extension-subtrees/, encoding the upstream-first proceduredev-docs/subtree-extensions.md— gains "Updating an extension" and "Recovery" sections, plus a typo fix on the prefix pathImportant
This branch contains subtree-pull commits at the tip and cannot be rebased — merge to
mainwithout rebasing.Fixes #14524
Checklist
I have (if applicable):
AI-assisted PR