quarb-text 0.19.0

Shared text-level document semantics for the Quarb query engine
Documentation

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.