pub struct CitationSpec {Show 19 fields
pub options: Option<CitationOptions>,
pub template_ref: Option<TemplateReference>,
pub template: Option<Vec<TemplateComponent>>,
pub locales: Option<Vec<LocalizedTemplateSpec>>,
pub type_variants: Option<IndexMap<TypeSelector, TemplateVariant>>,
pub wrap: Option<WrapConfig>,
pub prefix: Option<String>,
pub suffix: Option<String>,
pub delimiter: Option<String>,
pub multi_cite_delimiter: Option<String>,
pub collapse: Option<CitationCollapse>,
pub sort: Option<GroupSortEntry>,
pub integral: Option<Box<CitationSpec>>,
pub non_integral: Option<Box<CitationSpec>>,
pub subsequent: Option<Box<CitationSpec>>,
pub ibid: Option<Box<CitationSpec>>,
pub note_start_text_case: Option<NoteStartTextCase>,
pub custom: Option<HashMap<String, Value>>,
pub unknown_fields: BTreeMap<String, Value>,
}Expand description
Citation specification.
Fields§
§options: Option<CitationOptions>Citation-specific option overrides merged over the style config.
template_ref: Option<TemplateReference>Reference to an embedded template preset or external template.
If both template-ref and template are present, template takes precedence.
template: Option<Vec<TemplateComponent>>Default template when no localized override is selected.
locales: Option<Vec<LocalizedTemplateSpec>>Locale-specific template overrides checked before the default template.
type_variants: Option<IndexMap<TypeSelector, TemplateVariant>>Type-specific template overrides for citations. When present, replaces
the default citation template for references of the specified types.
Type-variant lookup happens after mode (integral/non-integral) resolution.
If both the main spec and the active mode sub-spec have a type-variants
entry for the same type, the mode-specific one wins.
wrap: Option<WrapConfig>Wrap the entire citation in punctuation. Preferred over prefix/suffix.
prefix: Option<String>Prefix for the citation (use only when wrap doesn’t suffice, e.g., “ (“ or “[Ref “).
suffix: Option<String>Suffix for the citation (use only when wrap doesn’t suffice).
delimiter: Option<String>Delimiter between components within a single citation item (e.g., “, “ or “ “). Defaults to “, “.
multi_cite_delimiter: Option<String>Delimiter between multiple citation items (e.g., “; “). Defaults to “; “.
collapse: Option<CitationCollapse>Optional collapse behavior for adjacent multi-item citations.
sort: Option<GroupSortEntry>Optional citation sorting specification.
integral: Option<Box<CitationSpec>>Configuration for integral (narrative) citations (e.g., “Smith (2020)”). Overrides fields from the main citation spec when mode is Integral.
non_integral: Option<Box<CitationSpec>>Configuration for non-integral (parenthetical) citations (e.g., “(Smith, 2020)”). Overrides fields from the main citation spec when mode is NonIntegral.
subsequent: Option<Box<CitationSpec>>Configuration for subsequent citations. Overrides fields from the main citation spec when position is Subsequent. Useful for short-form citations in note-based styles or author-date styles that show abbreviated citations after the first mention.
ibid: Option<Box<CitationSpec>>Configuration for ibid citations (ibid or ibid with locator).
Overrides fields from the main citation spec when position is Ibid or IbidWithLocator.
If present, takes precedence over subsequent for these positions.
Allows compact rendering like “ibid.” or “ibid., p. 45”.
note_start_text_case: Option<NoteStartTextCase>Optional text-case transform for standalone note-start citation output.
This is a style-owned rendering dimension layered on top of the
existing repeated-note state, not a new citation Position.
custom: Option<HashMap<String, Value>>Custom user-defined fields for extensions.
unknown_fields: BTreeMap<String, Value>Forward-compat: captures unknown keys when an older engine reads a
style produced by a newer schema. Empty by default; treated as a
SoftDegrade signal. See docs/specs/FORWARD_COMPATIBILITY.md.
Implementations§
Source§impl CitationSpec
impl CitationSpec
Sourcepub fn resolve_template(&self) -> Option<Vec<TemplateComponent>>
pub fn resolve_template(&self) -> Option<Vec<TemplateComponent>>
Resolve the effective template for this citation.
Returns the explicit template if present, otherwise resolves template-ref.
Returns None if neither is specified.
Sourcepub fn resolve_template_for_language(
&self,
language: Option<&str>,
) -> Option<Vec<TemplateComponent>>
pub fn resolve_template_for_language( &self, language: Option<&str>, ) -> Option<Vec<TemplateComponent>>
Resolve the template for a language by checking localized overrides, then the localized default, then the base template or preset.
Sourcepub fn resolve_template_for_type(
&self,
ref_type: &str,
language: Option<&str>,
) -> Option<Vec<TemplateComponent>>
pub fn resolve_template_for_type( &self, ref_type: &str, language: Option<&str>, ) -> Option<Vec<TemplateComponent>>
Resolve the template for a given reference type and language.
First checks type_variants for an entry matching ref_type.
Falls back to resolve_template_for_language if no type-specific
template is found.
Sourcepub fn resolve_for_mode(&self, mode: &CitationMode) -> Cow<'_, CitationSpec>
pub fn resolve_for_mode(&self, mode: &CitationMode) -> Cow<'_, CitationSpec>
Resolve the effective spec for a given citation mode.
If a mode-specific spec exists (e.g., integral), it merges with and overrides
the base spec.
Sourcepub fn resolve_for_position(
&self,
position: Option<&Position>,
) -> Cow<'_, CitationSpec>
pub fn resolve_for_position( &self, position: Option<&Position>, ) -> Cow<'_, CitationSpec>
Resolve the effective spec for a given citation position.
If a position-specific spec exists (e.g., ibid for Ibid position),
it merges with and overrides the base spec. Position resolution should
be applied before mode resolution to allow position-specific modes.
Priority: ibid > subsequent > base
Trait Implementations§
Source§impl Clone for CitationSpec
impl Clone for CitationSpec
Source§fn clone(&self) -> CitationSpec
fn clone(&self) -> CitationSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more