Repository navigation
feat: render_html, WeasyPrint as the pdf extra, themes in the wheel - #3
Merged
Merged
Conversation
galley keeps the deck path and render_pdf; emit.py holds page geometry, _emit_css, emit and resolve_theme_name, and imports nothing from WeasyPrint. galley re-exports every moved name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
prepare() runs the preprocessors and the parser; render_html() emits the document; render_pdf() is prepare + WeasyPrint. WeasyPrint is imported only on the PDF and deck paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The wheel packaged only scriptorium/, and THEMES_DIR pointed at the repo root, so any non-editable install had no themes (0 of 24 wheel files). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
render_html/prepare take frozen=True: cache hits are served, misses show the source with a warning, nothing is tangled or run. scriptorium.yaml can carry `execute:` (interpreters, timeout). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 5, 2026
# Conflicts: # scriptorium/galley.py # scriptorium/project.py
# Conflicts: # scriptorium/galley.py # scriptorium/project.py
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 #2. Fixes #5.
What changed
scriptorium/render.py:prepare()(theme, vars, preprocessors, parse) andrender_html(), which returns the document HTML.render_pdf()is nowprepare+ WeasyPrint, with its report unchanged.scriptorium/emit.py:emit(),_emit_css(), page geometry andresolve_theme_name, moved verbatim out ofgalley.pywith an AST script.galleyre-exports every moved name, so existing imports keep working. galley now holds onlyrender_pdf,page_fillsand the deck path.WeasyPrint is the
pdfextra and is imported lazily inmeasure,_render_deckandrender_pdf. Without it,render_pdfraisesRuntimeError("PDF output needs WeasyPrint: install scriptorium[pdf]").scriptorium render X --htmlwrites the HTML document (single file orscriptorium.yaml). A deck theme raisesValueErrorfromrender_html.Themes are force-included in the wheel;
THEMES_DIRresolves inside the package first, then the repo root.Frozen renders (Frozen renders, and execute settings for projects #5):
render_html(..., frozen=True)serves.scriptorium/freeze.jsonhits and never runs or tangles; a miss shows the source and warns.scriptorium.yamlnow forwardsexecute:(interpreters,timeout).Measured
tests/test_render_html.py, all seen failing first).sys.modules['weasyprint'] = None:render_htmlworks, the CLI--htmlpath works,render_pdfnames the extra.uv run --with <wheel>install (nopdfextra,weasyprintnot installed) renders atheme: bookdocument.Left out
uv run pytest -qlocally (261 passed).measure()/pack()untouched; removing galley is separate work.First consumer: apiad/marginalia#5.
🤖 Generated with Claude Code