1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//! The options of text resolution: [`BlocksConfig`], which says which families
//! of typographic substitution the [block-structure pass](super) applies.
//!
//! The block-structure pass resolves the text of a tree once (see the
//! [module documentation](super)), and in the same scan applies the typographic
//! substitutions that the source spells out: `--` means an en dash in the same
//! way that `\emph{…}` means emphasis, so the substitution is a property of the
//! text and not of one output format. [`BlocksConfig`] holds one flag per family
//! of substitutions. Collapsing whitespace is not one of the families: it
//! always happens and has no flag.
//!
//! The `blocks` feature ([`crate::stdlib::features::blocks`]) takes a
//! [`BlocksConfig`] as its configuration, a value fixed when the registry is
//! built (see [settings, options and
//! configuration](crate::guide::concepts_overview#settings-options-and-configuration)).
//! The feature feeds the flags into the registry's [structural
//! digest](crate::model::digest)
//! ([`FlmRegistry::digest`](crate::core::registry::FlmRegistry::digest)), which
//! every cache key of the library includes, so that two registries that differ
//! in these options never share cached trees.
/// The options of text resolution in the [block-structure pass](super): one
/// flag per family of typographic substitutions. Collapsing whitespace always
/// happens and has no flag.
///
/// Every family is on by default, so that FLM source written with the usual TeX
/// spellings (`` `quoted' ``, `--`, `...`) is shown as its author meant it in
/// every output format. Switch a family off to have those spellings reach the
/// output unchanged.
///
/// A value is passed to [`structure`](super::structure), or to the `blocks`
/// feature's constructor
/// ([`Blocks::new`](crate::stdlib::features::blocks::Blocks::new)). Because
/// every field is public, a value can be built from the default with one change,
/// or from [`no_typography`](BlocksConfig::no_typography) with one family
/// switched on. In settings written as data ([`crate::core::settings`]), the
/// fields are the settings keys of the `blocks` feature, and a key left out
/// takes its default.
///
/// # Examples
///
/// ```
/// use flm_core::lang::rewrites::blocks::BlocksConfig;
///
/// let default = BlocksConfig::new();
/// assert!(default.any_typography());
///
/// // Everything but the dash ligatures.
/// let config = BlocksConfig { ligature_unicode_dashes: false, ..default };
/// assert!(config.any_typography());
/// assert!(!BlocksConfig::no_typography().any_typography());
/// ```