pub enum SubstitutionSpec {
Explicit(Vec<Substitution>),
Modifiers(Vec<SubstitutionOp>),
}Expand description
Specification for substitutions to apply to a block.
This type represents how substitutions are specified in a subs attribute:
- Explicit: A direct list of substitutions (e.g.,
subs=specialchars,quotes) - Modifiers: Operations to apply to the block-type default substitutions
(e.g.,
subs=+quotes,-callouts)
The parser cannot know the block type when parsing attributes (metadata comes before the block delimiter), so modifier operations are stored and the converter applies them with the appropriate baseline (VERBATIM for listing/literal, NORMAL for paragraphs).
§Serialization
Serializes to a flat array of strings matching document syntax:
- Explicit:
["special_chars", "quotes"] - Modifiers:
["+quotes", "-callouts", "macros+"]
Variants§
Explicit(Vec<Substitution>)
Explicit list of substitutions to apply (replaces all defaults)
Modifiers(Vec<SubstitutionOp>)
Modifier operations to apply to block-type defaults
Implementations§
Source§impl SubstitutionSpec
impl SubstitutionSpec
Sourcepub fn apply_modifiers(
ops: &[SubstitutionOp],
default: &[Substitution],
) -> Vec<Substitution>
pub fn apply_modifiers( ops: &[SubstitutionOp], default: &[Substitution], ) -> Vec<Substitution>
Apply modifier operations to a default substitution list.
This is used by converters to resolve modifiers with the appropriate baseline.
Sourcepub fn resolve(&self, default: &[Substitution]) -> Vec<Substitution>
pub fn resolve(&self, default: &[Substitution]) -> Vec<Substitution>
Resolve the substitution spec to a concrete list of substitutions.
- For
Explicit, returns the list directly - For
Modifiers, applies the operations to the provided default
Trait Implementations§
Source§impl Clone for SubstitutionSpec
impl Clone for SubstitutionSpec
Source§fn clone(&self) -> SubstitutionSpec
fn clone(&self) -> SubstitutionSpec
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more