Skip to main content

Crate quarb_text

Crate quarb_text 

Source
Expand description

The text level: a shared, source-independent semantics for written documents — sections, paragraphs, quotes, lists, and verbatim blocks — produced by format crates and served by this crate’s single adapter.

The block model follows the atrep markup language (litogramma’s koine core): every block is (kind, taxis?, lemma?, body, hypograph?) — the lemma is the head or title, the hypograph the footer or attribution, and a paragraph is the degenerate lemma-less, hypograph-less block. Producers (quarb-text-html, quarb-text-markdown, the built-in plain-text reader) lower their format into the Block event stream; this crate derives the section tree and implements the adapter once, so //section[::lemma ...], //paragraph, and //blockquote read identically over any text substrate — including an atrep document mounted by quarb-atrep.

  • Node names are the structural kinds: section, paragraph, blockquote, unordered-list, ordered-list, unordered-item, ordered-item, verbatim.
  • ::lemma, ::hypograph, and ::taxis are properties; bare :: (and ::text) is the flattened prose of the subtree, lemma first, hypograph last.
  • ::::level on a section is the source heading level; ::::lang on a verbatim block is its declared language.
  • Sections are derived from the flat heading stream by the outline rule: a heading closes every open section at its level or deeper, then opens a section under the nearest shallower one. Content before the first heading belongs to the document root. A heading inside an open container (blockquote, list) is decorative, not sectioning: it lowers to a paragraph of its text.
  • Every kind admits ::lemma, ::taxis, and ::hypograph — the atrep model, where these are universal affordances of a block rather than privileges of particular kinds.
  • Tables denormalize into nested lists: an ordered-list carrying the <table> trait (::lemma = the caption), one ordered-item per row (::taxis = row number, <row> trait), one unordered-item per cell (<cell> trait) whose ::lemma is the column name — from the header row in grids, from the row’s th label otherwise; headerless cells carry no lemma. A lemma’d item flattens as lemma: prose, so a row exists, the bare cell text otherwise. Empty cells are skipped.

Modules§

render
Re-export of the koine renderer, which moved into the engine core when | markdown / | html / | atrep became pipeline stages (the stage and the export button are the same verb). The extension, the wasm builds, and the notebook exporters keep their quarb_text::render_* paths through this shim.

Structs§

Cell
One table cell as a producer hands it over: the text, plus the label a row-shaped dialect attaches directly (an infobox row’s th). Grid dialects leave label empty and let the lowering zip the header row on by position.
TextModel
A Quarb adapter over a text-level document.

Enums§

Block
A block-level event in the text-level vocabulary — what a format producer emits. Headings arrive flat; the section tree is derived here, once, for every producer.
Container
The nesting containers a producer opens and closes explicitly.
Render
The output markup of a render call.

Functions§

normalize_ws
Collapse whitespace runs to single spaces and trim — the prose normalization producers apply to inline content. Verbatim text is the exception: it is kept as authored.
render_node
Render one subtree. For litogramma the document opens with its dialektos declaration, so every rendered subtree is a valid .atd from byte one.
render_nodes
Render each node’s subtree in order, blank-line separated.