flm_core/model/mod.rs
1//! The document model: the types that describe what a document is made of,
2//! how its parts are identified, and the option values set on it.
3//!
4//! This module defines the data a document is described in, and nothing about
5//! how a document is processed. Its main concepts are these:
6//!
7//! - A **document** ([`Doc`](doc::Doc)) is a set of trees of parsed nodes,
8//! built from one or more **fragments** ([`Fragment`](doc::Fragment)), each
9//! fragment being one piece of source as the parser delivered it.
10//! - Every node carries an **element** ([`ElementSpec`](element::ElementSpec)),
11//! the value that says what the node means.
12//! - An element carries **aspects**: pieces of behavior attached to the element
13//! when a feature registers it, which the rest of the library reads back
14//! through trait objects (see [elements and
15//! aspects](crate::guide::concepts_overview#elements-and-aspects)).
16//! - Every node of a document has an **address** ([`NodeAddr`](addr::NodeAddr)),
17//! the key under which computed data about the node is stored.
18//! - Every entity registered with the library (a stage, a table, a capability,
19//! a feature, …) is identified by a dotted **name** ([`Name`](names::Name)).
20//! An element has a dotted type name too, but it is identified by its element
21//! value, the allocation of its [`ElementSpec`](element::ElementSpec).
22//! - A document also carries the **option values** set on it when it was
23//! built ([`OptionValues`](options::OptionValues)).
24//!
25//! See [the document tree](crate::guide::concepts_overview#the-document-tree)
26//! for an introduction, and the [document model guide](crate::guide::document_model)
27//! for the whole picture.
28//!
29//! The library processes a document with the types of [`crate::core`]: stages,
30//! the registry, plans, runs and the store of computed data. This module uses
31//! none of them.
32//!
33//! # The modules
34//!
35//! - [`names`] — dotted names, and one Rust type per kind of name
36//! ([`ElementName`](names::ElementName), [`CapName`](names::CapName), …).
37//! - [`addr`] — [`TreeId`](addr::TreeId) and [`NodeAddr`](addr::NodeAddr), the
38//! identifiers of a tree and of a node, under which computed data is stored
39//! per node.
40//! - [`element`] — [`ElementSpec`](element::ElementSpec), the
41//! [`AspectMap`](element::AspectMap) holding an element's aspects, and the
42//! rule that two elements are the same when they are the same allocation.
43//! - [`aspects`] — the aspects that the standard features implement and read:
44//! block roles, reference points, reference sites, headings, content outside
45//! the surrounding text, what replaces a node in a copy of content, and
46//! whether a node is whitespace.
47//! - [`doc`] — fragments, a document's content (its tree arena, traversal list
48//! and resolution map), the document itself, and the walk that defines
49//! document order.
50//! - [`assemble`] — [`assemble`](assemble::assemble), which parses a document's
51//! primary file together with the files it includes with `\input` into a
52//! document's content.
53//! - [`options`] — option types, the values set for them on a document or on a
54//! render request, and how a stage reads them.
55//! - [`digest`] — [`Fnv1a64`](digest::Fnv1a64), the deterministic hasher behind
56//! every digest this crate computes, and [`digest_of`](digest::digest_of).
57//!
58//! # Position in the crate's layers
59//!
60//! The [crate documentation](crate) orders the crate's modules in layers, each
61//! using only the layers below it. This module and [`crate::lang`] form the
62//! bottom layer together:
63//!
64//! ```text
65//! {model, lang} < core < dump < stdlib < math_passthrough layout standalone
66//! ```
67//!
68//! The two modules share one layer because each one uses the other: a parsed
69//! node carries its element, so the language uses the model, and a fragment
70//! holds a tree typed by the language, so the model uses the language.
71//! Together they use nothing else of this crate.
72
73pub mod addr;
74pub mod assemble;
75pub mod aspects;
76pub mod digest;
77pub mod doc;
78pub mod element;
79pub mod names;
80pub mod options;