Skip to main content

Crate quarb_text_html

Crate quarb_text_html 

Source
Expand description

HTML producer for the Quarb text level: reduces a page to what it says — headings, paragraphs, quotes, lists, verbatim blocks, tables — and drops the markup soup. The DOM-faithful view is quarb-html; this crate lowers the same substrate into the shared quarb-text vocabulary, so //section[::lemma ...] and //paragraph read the same over a page as over any other text substrate.

Producer rules (the HTML-specific knowledge lives here):

  • h1h6 become flat Block::Headings; quarb-text derives the enclosing section tree.
  • Soup is dropped: script, style, nav, header, footer, aside, form, media elements, the whole head — and, whatever the element, ARIA chrome (landmark roles like navigation/banner, or aria-hidden="true").
  • Structural wrappers (div, section, article, main, …) are transparent: their flow content is walked, the wrapper itself leaves no node.
  • A blockquote’s trailing cite/footer child — or the figcaption of a figure-wrapped quote — becomes the quote’s hypograph (attribution).
  • pre becomes a verbatim block, language from a language-* class; table becomes a Block::Table (caption from <caption>, headers from thead/th cells), denormalized to nested lists by quarb-text.
  • Inline markup flattens to its text.

Functions§

blocks
The event stream parse builds from — exposed for testing and composition.
parse
Parse html and lower it to a text-level document.