Repository navigation
Conversation
Every document was emitted as <html lang='en'>, so Spanish text hyphenated with English patterns. Frontmatter or scriptorium.yaml `lang:` now sets it, a theme can default it (uh -> es), and the fallback stays en. Fixes #8 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8.
What changed
galley._lang()readslang:from the frontmatter orscriptorium.yamlfirst, then from the theme's top-levellang:, and falls back toen.emit()andemit_deck()write the result into<html lang>, and WeasyPrint uses that attribute to pick its pyphen hyphenation dictionary. The value lands inside an HTML attribute, so anything that is not a BCP 47-shaped tag raisesValueError.project.pycarrieslangthrough as a content key.uhdefaults tolang: es. Its description is already Spanish, and it exists for Universidad de La Habana documents. No other theme changes.Measured
tests/test_lang.pyhas 5 new tests. They render 30 copies of "desarrollo" in a 12 mm column, which is narrower than the word, so the column has to hyphenate:desar‐appears.lang: es, every break is one ofde‐,desa‐,desarro‐, anddesar‐never appears.uhtheme with nolang:key behaves like Spanish.langinscriptorium.yamlreaches the render.ValueError.langwas set, because each word fit on its own line. That is why the column is now 12 mm. With thelangentry removed from the project allowlist, the project test fails.Note
This PR branches from
mainbefore #10, the CI workflow, so it gets no check run until #10 merges and this branch is rebased onto it.🤖 Generated with Claude Code