Expand description
The renderer (docs/tooling/05_render.md): the form a module declares
for an output with @render — a format and a layout, a template, a
destination, a fan-out — read from the annotation (§3), the structured
text of a document in that form (§4), and the templates (§5) and the
fan-out (§6) that turn one evaluated root into text or files. The
command line, the REPL, the library, and the editor preview all emit
through here, so that the three implementations print the same bytes.
A port of the reference’s render.ts.
Structs§
- Context
- what a template renders over (§5.4)
- Delimiters
- a template’s delimiters (§5.2): each an opener and a closer
- Emission
- what emits one root: its value, its form with the invocation’s overrides, and the template’s text when there is one
- Form
- the declared form of a root (§3): what
@rendersays, every key optional - Render
Error - a rendering diagnostic: the code, the message, and where —
L:Cof the tag, or a document path - Template
- a parsed template: its path as given (diagnostics), its directory (includes), its nodes
Enums§
- Emitted
- the text a root is emitted as: one text, or the files of a fan-out (§6), path by path
Functions§
- absolute
- an absolute, normalized path (
.and..resolved), as the reference’s host resolves one - declared_
form - the form
@renderdeclares on a declaration (§3), or the E7004 message naming what is wrong with it; a declaration without one is canonical JSON - emit_
root - emit one root (§3.1): its structured text or its template’s text, as one text or one file per element
- emit_
root_ to - Emit such a root to a writer without building its text whole; the bytes
are
emit_root’s. - emits_
in_ pieces - Whether a root’s text is the engine’s compact JSON and nothing else: no template, no fan-out, no layout pass, and a container, whose serialization always has text. Such a root can go to a file in pieces.
- layout
- the structured text of a document (read_json’s shape) in a format and layout (§4), one trailing newline
- parse_
template - parse a template’s text (§5.2–5.3); E7001 for what does not parse.
pathis the template’s path as given (its diagnostics name it);diris where its includes resolve, the absolute directory it was read from - render_
template - render a parsed template over a context (§5); a RenderError carries the diagnostic
- resolve_
in dir/relabsolute and normalized (an absoluterelwins)- text_
form - the text form of a value (§5.5); Err((code, message)) when it has none