pub struct NumberingConfig {
pub styles: Vec<CounterStyleDecl>,
}Expand description
The configuration of the numbering feature: counter styles to be
used in place of declared counter styles.
A counter style (CounterStyleDecl) specifies how the numbers of a
counter are written: the number format, the word before the number (e.g.,
Eq.~), the delimiters (e.g., parentheses), and the texts that join
several numbers. Counter styles are declared in the features that number
constructs, such as the headings feature. With this configuration, a host
program can change a declared counter style without writing a feature.
Each entry of styles is a complete counter
style that is used in place of the declared counter style with the same
name. If no
counter style with this name is declared in any feature, the registry build
fails.
The configuration is fixed when the registry is built, because the texts
of the counter styles are parsed at that time (settings, options and
configuration).
The counter styles cannot be changed for a single document. The numbering
options of a document (NumberingOptions) can
only change the counters within which a counter is numbered, how their
numbers are written before the number of the counter, and the initial
value of the counter.
A host program passes the configuration as the numbering field of
StdlibConfig, or in settings data as
the settings key styles of the numbering feature. In settings data,
styles is a map from the name of a counter style to its replacement. The
fields missing from an entry take the defaults of
CounterStyleDecl::new (a decimal number, no word, no delimiters, the
default join texts), and not the values of the declared counter style.
Therefore each field of the declared counter style that is to be kept must
be repeated in the entry.
§Examples
use flm_core::stdlib::features::numbering::{
CounterStyleDecl, Delimiters, NumberingConfig, PrefixWords,
};
let mut equations = CounterStyleDecl::new("flm.math.style.equation");
equations.delimiters = Delimiters::new("[", "]");
equations.prefix_words = PrefixWords::new("Gl.~", "Gln.~");
let config = NumberingConfig::new().style(equations);
assert_eq!(config.styles.len(), 1);Fields§
§styles: Vec<CounterStyleDecl>The replacement counter styles. Each entry is used in place of the counter style declared with the same name.
In settings data, the fields missing from an entry take the defaults
of CounterStyleDecl::new, and not the values of the declared
counter style.
Implementations§
Source§impl NumberingConfig
impl NumberingConfig
Sourcepub fn new() -> NumberingConfig
pub fn new() -> NumberingConfig
Returns the default configuration, which contains no replacement counter style.
Sourcepub fn style(self, style: CounterStyleDecl) -> NumberingConfig
pub fn style(self, style: CounterStyleDecl) -> NumberingConfig
Adds style to the replacement counter styles, and returns the
configuration. style is used in place of the counter style declared
with the same name.
Sourcepub fn digest_bytes(&self) -> Vec<u8> ⓘ
pub fn digest_bytes(&self) -> Vec<u8> ⓘ
Returns the bytes that this configuration contributes to the registry digest.
The bytes contain every field of every replacement counter style. Therefore two configurations that differ in any field give different bytes.
Trait Implementations§
Source§impl Clone for NumberingConfig
impl Clone for NumberingConfig
Source§impl Debug for NumberingConfig
impl Debug for NumberingConfig
Source§impl Default for NumberingConfig
impl Default for NumberingConfig
Source§impl<'de> Deserialize<'de> for NumberingConfigwhere
NumberingConfig: Default,
impl<'de> Deserialize<'de> for NumberingConfigwhere
NumberingConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for NumberingConfig
Source§impl Hash for NumberingConfig
impl Hash for NumberingConfig
Source§impl JsonSchema for NumberingConfig
impl JsonSchema for NumberingConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for NumberingConfig
impl PartialEq for NumberingConfig
impl StructuralPartialEq for NumberingConfig
Auto Trait Implementations§
impl Forget for NumberingConfig
impl Freeze for NumberingConfig
impl Move for NumberingConfig
impl RefUnwindSafe for NumberingConfig
impl Send for NumberingConfigwhere
RawVecInner: Send,
Arc<str>: Send,
NodeRef<Owned, String, PluralWords, LeafOrInternal>: Send,
BoxRaw<(String, PluralWords)>: Send,
impl Sync for NumberingConfigwhere
RawVecInner: Sync,
Arc<str>: Sync,
NodeRef<Owned, String, PluralWords, LeafOrInternal>: Sync,
BoxRaw<(String, PluralWords)>: Sync,
impl Unpin for NumberingConfig
impl UnsafeUnpin for NumberingConfig
impl UnwindSafe for NumberingConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more