Incorporates target as part of rheo-context#150
Merged
Conversation
Adds an optional `target` field (the output-format name, e.g. "html"/"epub") to both the per-vertebra `#let rheo-context` prelude and the global `sys.inputs.rheo-context` dict. Omitted for PDF so the native `target()` fallback is preserved. No consumer changes yet.
The output format now lives solely on `sys.inputs.rheo-context.target`. The injected `target()` polyfill and the `is-rheo-*` helpers in rheo.typ read that location, and the deprecated `sys.inputs.rheo-target` key is removed. Removes the redundant `rheo-target()` helper — with the `target()` polyfill it was identical to `target()`; documents and plugins use `target()` (and the `is-rheo-*` helpers) directly.
Adds the `target` field to the rheo-context field list, notes it is absent for PDF, and documents that the output format is read via the `target()` polyfill or the `is-rheo-*` helpers now that `sys.inputs.rheo-target` is removed.
Adds a `rheo migrate` migration that rewrites direct author references to the removed `sys.inputs.rheo-target` key and `rheo-target()` helper: - `rheo-target()` -> `target()` - `"rheo-target" in sys.inputs` -> `"rheo-context" in sys.inputs and "target" in sys.inputs.rheo-context` - `sys.inputs.rheo-target` -> `sys.inputs.rheo-context.target` Applies to any project older than the current release. Honours dry-run vs --apply, reports each rewrite with file:line, and warns on residual `rheo-target` literals.
The is-rheo-epub/html/pdf() helpers lived in rheo.typ, which is injected only into the synthetic main; authored vertebrae are #include'd and never see them, so calling them errored with 'unknown variable'. The reachable output-format API is the per-file target() polyfill. Drops the dead helpers and points the docs at target().
eeb5222 to
84f43a7
Compare
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.
Moves the output format off the standalone
sys.inputs.rheo-targetkey onto atargetfield ofrheo-context, so the build context lives in one place. Follows #149.targettorheo-context— on both the per-vertebra#letprelude and the globalsys.inputs.rheo-context(rheo_context_preludes/global_context,crates/core/src/reticulate/spine.rs). Set for HTML/EPUB; absent for PDF, sotarget()keeps its native"paged".target()polyfill andbuild_inputsnow readsys.inputs.rheo-context.target; thesys.inputs.rheo-targetkey is dropped (crates/core/src/world.rs).rheo-target()helper — with the polyfill it was justtarget(). Authored files usetarget()directly.is-rheo-epub/html/pdf()helpers fromrheo.typ. They were unreachable:rheo.typis injected only into the synthetic main, and authored vertebrae are#included and never see it. Format detection istarget()(e.g.target() == "epub").Migration
rheo migraterewrites direct references in.typsources for any project older than the current release:rheo-target()→target()"rheo-target" in sys.inputs→"rheo-context" in sys.inputs and "target" in sys.inputs.rheo-contextsys.inputs.rheo-target→sys.inputs.rheo-context.targetDry run reports each rewrite with
file:line;--applywrites them and warns on any residualrheo-targetliteral it doesn't cover.Docs updated (CLAUDE.md
rheo-contextsection,FormatPluginrustdoc). The0.5.0version bump lands separately.