Skip to main content

Module rules

Module rules 

Source
Expand description

The synthesized elements of the table of contents and their general lowering rules, the default on every backend.

The three elements are PIECE (the root), LIST and ENTRY. They are synthesized: no document can write them, and the stage BuildToc builds them. Each declares the block role Block, so the block-structure pass, which runs over the value before it is lowered, wraps the title inside an entry in one paragraph, before the entry’s sub-list; the entry’s rule writes that paragraph as its content alone. The rules stage:

  • the root (RootRule): a flm.pres.block of role flm.toc, kind token toc and document role DocRole::Toc, holding its list;
  • a list (ListRule): an unlabeled flm.pres.list of kind tokens unnumbered and toc, each entry with an empty label;
  • an entry (EntryRule): the number in a span of role NUMBER_ROLE and a space, where the heading has a number; the title; both inside one link to the heading’s anchor where it has one; then the sub-list, where there is one.

The rules read the counters and anchors tables where they are computed, and are registered with peer declarations of those tables and of the presentation elements they produce, so that the feature builds in a registry without the numbering or refs features.

Structs§

EntryRule
The general lowering rule of one entry, the element ENTRY, flm.toc.entry.lower.default. It reads the entry’s payload (TocEntryPayload) and stages
ListRule
The general lowering rule of a list of entries, the element LIST, flm.toc.list.lower.default. It stages
RootRule
The general lowering rule of the root of the table of contents, the element PIECE, flm.toc.lower.default. It stages

Constants§

LINK_KIND
The link kind of an entry’s link, toc.

Functions§

rule_name
Returns the name of the general lowering rule of the element element, <element>.lower.default.