Expand description
The text construct elements: content set at the right edge of its line, and a run of blocks set between rule lines, as nodes in the lowered tree.
A construct element is a presentation element that mirrors one 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). Plain text has two constructs that the shared presentation vocabulary cannot express, since they depend on the width of the printed lines: a part of a line pushed to the right edge, such as an equation’s number, and rule lines as wide as the content they enclose, such as the rules above and under a document’s title. This module holds the two elements that mirror them, with their payloads:
| element | payload | slots | printed as |
|---|---|---|---|
FLUSH_RIGHT (flm.pres.text.flush-right) | FlushRightPayload: no data | one BODY_SLOT, inline content | its content on one line, ending at the last column of the line width where it fits there, otherwise FLUSH_RIGHT_GAP columns after what precedes it |
RULED (flm.pres.text.ruled) | RuledPayload: whether a rule line stands above the body, and whether one stands under it | one BODY_SLOT, a run of blocks | its body on lines of its own, between rule lines as wide as the widest printed line of the body |
The text emitter prints them with the layout engine’s
constructors DocBuf::flush_right
and DocBuf::ruled; its module
documentation states what each prints in full.
The text feature (super::TextBackend), which registers the text
backend, registers both elements through register, and the text
backend writes them natively (native_elements).
They are not part of the shared presentation vocabulary
(ALL): a backend that is not the
text backend cannot write them, and a lowering rule that stages one (builds
a node of it into the lowered tree; see
Lowerer) is a rule for the text
backend. A feature that stages one without registering the text feature
itself declares it through a peer declaration
(PeerName,
FeatureBuilder::peer_element).
§Projections
Each payload implements PresPayload with a self-contained projection
(the value written when a lowered tree is serialized,
crate::dump::session) and has a registered reader that rebuilds the
payload from it (payload_readers). The projections are: flush-right:
{}; ruled: {above, below}, two booleans, an absent or null key read
as false.
Structs§
- Flush
Right Payload - The payload of
flm.pres.text.flush-right: it holds no data. The node’s content, in its body slot, is what is set at the right edge. - Ruled
Payload - The payload of
flm.pres.text.ruled: where the rule lines stand around the node’s body.
Constants§
- ALL
- The two construct elements of the text backend, in the order of the module documentation’s table.
- FLUSH_
RIGHT flm.pres.text.flush-right— inline content set at the right edge of its line.- FLUSH_
RIGHT_ GAP - The columns between the content of a
FLUSH_RIGHTnode and what precedes it on its line, where the content does not fit at the right edge of the line or the line has no width: four. - RULED
flm.pres.text.ruled— a run of blocks set between rule lines as wide as its widest printed line.
Functions§
- payload_
readers - Returns the payload readers of the two construct elements: what a reading
session (
reader_with) needs, beside the shared vocabulary’s own (payload_readers), to read a stored lowered tree of the text backend back into typed payloads. - register
- Registers the construct elements
flm.pres.text.flush-rightandflm.pres.text.ruledwith their payload types. Thetextfeature (super::TextBackend) calls this from its own registration; a second registration in one registry declares the elements twice and fails the build.