Skip to content

Incorporates target as part of rheo-context#150

Merged
breezykermo merged 5 commits into
mainfrom
feat/rheo-context-target
Jul 12, 2026
Merged

Incorporates target as part of rheo-context#150
breezykermo merged 5 commits into
mainfrom
feat/rheo-context-target

Conversation

@breezykermo

@breezykermo breezykermo commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Moves the output format off the standalone sys.inputs.rheo-target key onto a target field of rheo-context, so the build context lives in one place. Follows #149.

  • Adds an optional target to rheo-context — on both the per-vertebra #let prelude and the global sys.inputs.rheo-context (rheo_context_preludes/global_context, crates/core/src/reticulate/spine.rs). Set for HTML/EPUB; absent for PDF, so target() keeps its native "paged".
  • The target() polyfill and build_inputs now read sys.inputs.rheo-context.target; the sys.inputs.rheo-target key is dropped (crates/core/src/world.rs).
  • Removes the rheo-target() helper — with the polyfill it was just target(). Authored files use target() directly.
  • Removes the is-rheo-epub/html/pdf() helpers from rheo.typ. They were unreachable: rheo.typ is injected only into the synthetic main, and authored vertebrae are #included and never see it. Format detection is target() (e.g. target() == "epub").

Migration

rheo migrate rewrites direct references in .typ sources 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-context
  • sys.inputs.rheo-targetsys.inputs.rheo-context.target

Dry run reports each rewrite with file:line; --apply writes them and warns on any residual rheo-target literal it doesn't cover.

Docs updated (CLAUDE.md rheo-context section, FormatPlugin rustdoc). The 0.5.0 version bump lands separately.

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.
@breezykermo breezykermo marked this pull request as ready for review July 11, 2026 16:44
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().
@breezykermo breezykermo force-pushed the feat/rheo-context-target branch from eeb5222 to 84f43a7 Compare July 11, 2026 17:03
@breezykermo breezykermo merged commit 1d410f0 into main Jul 12, 2026
9 of 10 checks passed
@breezykermo breezykermo deleted the feat/rheo-context-target branch July 12, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant