Skip to main content

flm_core/stdlib/features/
mod.rs

1//! The standard features of [`stdlib`](crate::stdlib), one feature per submodule;
2//! the standard backend features are in
3//! [`stdlib::backends`](crate::stdlib::backends).
4//!
5//! Each submodule documents one feature ([`FlmFeature`](crate::core::registry::FlmFeature)):
6//! the commands and environments it provides to authors and what they produce, and the
7//! elements, tables, stages, lowering rules and settings it registers.
8//!
9//! [`stdlib::add_features`](crate::stdlib::add_features) adds all of them but
10//! [`compose`], which a host registers (see [below](self#a-feature-a-host-registers)). A program may
11//! register a feature without the rest of the standard features: a feature declares what it uses
12//! of a feature it can do without as a peer declaration
13//! ([`PeerName`](crate::core::registry::PeerName)), so the registry still builds without
14//! that feature. Some features need others, however (for example, the stages of `refs`
15//! read the tables of `refpoints` and `index`), and a plan that runs such a feature's
16//! stages fails when a feature it needs is absent
17//! ([`PlanError::NeedsUndeclared`](crate::core::plan::PlanError::NeedsUndeclared)). See
18//! [features and packages](crate::guide::concepts_overview#features-and-packages), and
19//! [the extension guide](crate::guide::extending) for writing a feature.
20//!
21//! # The features an author writes with
22//!
23//! These features declare the commands and environments an author writes:
24//!
25//! - [`textstyles`]: the inline formatting commands `\emph`, `\textbf`, `\textit` and
26//!   `\texttt`.
27//! - [`literals`]: the commands that stand for one character of text (`\%`, `\#`,
28//!   `\&`, `\$`, `\ `, `\{`, `\}`, `\textbackslash`), the character `~` (a non-breaking
29//!   space), and `\@`, a spacing hint that produces nothing.
30//! - [`headings`]: the heading commands `\section` to `\subparagraph`, and the heading
31//!   kinds and heading commands a program declares.
32//! - [`math`]: inline and display mathematics: the display-math environments and their
33//!   equation lines, the text commands of mathematics, `\eqref`, and equation numbering.
34//!   No feature of this package processes mathematics: a registry adds one, such as the
35//!   feature of the package [`math_passthrough`](crate::math_passthrough).
36//! - [`refs`]: labels and references: the `\label` field (a macro a construct reads as
37//!   data; see [fields](crate::guide::concepts_overview#fields-data-a-construct-reads)),
38//!   `\ref`, `\hyperref`, and the
39//!   stages that compute anchors and resolve references.
40//! - [`verbatim`]: content taken exactly as written: `\verbtext`, `\verbcode`,
41//!   `\verba`, and the environments `verbatimtext` and `verbatimcode`.
42//! - [`lists`]: the list environments `itemize`, `enumerate` and `description`, their
43//!   `\item`s, and the label beside each item.
44//! - [`xnotes`]: footnotes and the other kinds of text set apart from the running
45//!   text (xnotes), `\footnote{…}` by default, and the lists in which they are shown.
46//! - [`href`]: hyperlinks to an address outside the document: `\href`, `\url` and
47//!   `\email`.
48//! - [`defterm`]: defined terms: the `defterm` environment, which defines a term where
49//!   it is explained, and `\term`, a link to that definition.
50//! - [`theorems`]: the theorem-like environments `theorem`, `lemma`, `definition`,
51//!   `proof` and the theorem kinds a program configures, numbered, with a heading and
52//!   a proof's back-reference.
53//! - [`quote`]: quotations: `quote`, `blockquote`, `address` and the quote
54//!   environments a program configures, with their quotation sections (`\text`,
55//!   `\lines`, `\attributed`, `\block`).
56//! - [`annotations`]: a reviewer's highlights and comments, one command per reviewer
57//!   a program configures; none by default.
58//! - [`graphics`]: `\includegraphics[options]{path}`, an image, in a float's body or,
59//!   when the configuration allows it, anywhere in the text.
60//! - [`floats`]: `figure`, `table` and the float types a program configures: a block
61//!   of content shown where it is written, with a caption and labels, numbered under
62//!   its type's policy.
63//! - [`cells`]: tables of cells, the `cells` environment filled with `\cell` and
64//!   `\celldata`, in the body of a `table` float or, when the configuration allows it,
65//!   anywhere a block can be written.
66//! - [`citations`]: `\cite[note]{keys}`, each cited work numbered by first appearance
67//!   and shown as a citation mark, and the list of cited works.
68//! - [`input`]: `\input{file}`, the content of another file, brought in where the
69//!   command is written.
70//! - [`userdefs`]: the macros, environments and special character sequences an author
71//!   or a program defines by substitution (user definitions), and the stages that
72//!   expand them.
73//! - [`metadata`]: the document's metadata (title, authors and date), which a program
74//!   sets on the document and the feature shows before the content.
75//! - [`toc`]: the table of contents, the table of the listed headings and the piece
76//!   that shows them as nested lists before the content.
77//!
78//! # The features other features build on
79//!
80//! These features declare no command. They contribute rewrites, tables and stages
81//! that other features and the backends read:
82//!
83//! - [`blocks`]: the block-structure rewrite stage, which lays content out in
84//!   paragraphs and blocks, and the check of the tree contract.
85//! - [`index`]: the element index, the table of the nodes whose elements carry each
86//!   aspect, which the stages that look for such nodes read.
87//! - [`refpoints`]: the table of every reference point of a run, as the elements
88//!   declared them, which the [`refs`] and [`numbering`] features read.
89//! - [`numbering`]: counters, counter styles, and the number of every numbered
90//!   reference point: the [service slots](crate::core::services) in which features
91//!   declare their counters, counter styles and parent sets, the numbering options
92//!   ([`NumberingOptions`](numbering::NumberingOptions), set on a document or on a
93//!   render request) that say what a counter is numbered within, the stage that counts,
94//!   and the counter table `flm.counters`.
95//!
96//! # A feature a host registers
97//!
98//! This feature is not added by [`stdlib::add_features`](crate::stdlib::add_features); a host
99//! that wants it registers it in a package of its own:
100//!
101//! - [`compose`]: the service slots of the template engines and of the compose templates,
102//!   the template engine `content-only`, and one stage per output made of output regions,
103//!   which assembles the output's entry artifact through the chosen compose template. It
104//!   provides the same capability as each backend's final stage, so a registry holding it
105//!   needs a plan request that prefers one of the two.
106
107pub mod annotations;
108pub mod blocks;
109pub mod cells;
110pub mod citations;
111pub mod compose;
112pub mod defterm;
113pub mod floats;
114pub mod graphics;
115pub mod headings;
116pub mod href;
117pub mod index;
118pub mod input;
119pub mod lists;
120pub mod literals;
121pub mod math;
122pub mod metadata;
123pub mod numbering;
124pub mod quote;
125pub mod refpoints;
126pub mod refs;
127pub mod textstyles;
128pub mod theorems;
129pub mod toc;
130pub mod userdefs;
131pub mod verbatim;
132pub mod xnotes;