Expand description
The HTML construct element: one HTML tag, as a node in the lowered tree.
A construct element is a presentation element that mirrors one fundamental
construct of an output format, so that format-specific output is structured
data in the lowered tree rather than a string (see backends, lowering, and
outputs).
HTML’s fundamental construct is the tag, and this module holds the only
element that mirrors it, TAG (flm.pres.html.tag), with its payload
HtmlTagPayload: a tag name, attributes, and either children or one
string of HTML that is already formed (Markup).
| element | payload | slots |
|---|---|---|
TAG (flm.pres.html.tag) | HtmlTagPayload: the tag name, the attributes in order, the body, and whether the tag is block-level | one BODY_SLOT when the body is TagBody::Children; none when it is TagBody::Markup |
The html feature (super::HtmlBackend), which registers the HTML
backend, registers this element through register, and the HTML backend
writes it natively. It is not part of the shared presentation
vocabulary (ALL): a backend that
is not an HTML backend cannot write it, and a lowering rule that stages it
(builds a node of it into the lowered tree; see
Lowerer) is a rule for HTML. A feature
that stages it without registering the html feature itself declares it
through a peer declaration (PeerName,
FeatureBuilder::peer_element).
§When a rule uses it
Rarely. A lowering rule normally builds with the shared presentation
vocabulary (a paragraph, a block with a role, a span with a style, a list,
a link, an image), which every backend can write, so the rule’s output is
also written as plain text and as LaTeX. A rule stages a tag when it must
put HTML in the page that no shared element carries: a formula an external
tool typeset as <svg>, a widget a feature of its own defines, a tag the
browser must see for a script to find it.
The rule’s author is then responsible for everything about that tag. The
HTML contract (the classes and attributes derived
from the presentation vocabulary that a stylesheet may rely on) does not
apply to a construct node: the emitter writes the tag, the attributes and
the body as the payload states them and adds nothing of its own. The
address policy, which refuses an address a browser would
execute, does not apply either. So the rule’s author writes the classes its
own stylesheet needs, checks the addresses it writes (with
check_address, under the value of
HtmlAllowedUrlSchemes that its rule reads),
and, where the body
is markup, accepts the requirement stated at
Markup::trusted: the bytes are HTML that is
safe to place in a page, and anything that came from a document or from
another input the author does not control is sanitized first. The emitter
still checks the tag name and the attribute names, and writes a node whose
name fails as the unsupported stand-in
(flm.html.invalid-name).
Structs§
- Html
TagPayload - The payload of
flm.pres.html.tag: one HTML tag as structured data.
Enums§
Constants§
- TAG
flm.pres.html.tag— one HTML tag: a name, attributes, and either children or one string of HTML that is already formed (Markup).
Functions§
- payload_
readers - Returns the payload reader of the construct element: what a reading session
(
reader_with) needs, beside the shared vocabulary’s own (payload_readers), to read a stored lowered tree of the HTML backend back into typed payloads. - register
- Registers the construct element
flm.pres.html.tagwith its payload type. Thehtmlfeature (super::HtmlBackend) calls this from its own registration; a second registration in one registry declares the element twice and fails the build.