pub struct CitationsConfig {
pub placement: CitationPlacement,
pub mark: MarkForm,
pub style: CounterStyleDecl,
pub heading_title: Option<String>,
pub heading_level: u8,
pub note_separator: String,
}Expand description
The configuration of the citations feature: where the citation entries are
shown, the form of a citation mark, the citation counter style, the heading
of the list of cited works, and the text between the numbers and a note.
It is the plain Rust value the feature is constructed from
(Citations::new), fixed when the registry is
built (configuration).
It enters the registry digest
(digest_bytes), and its texts are
compiled when the registry is built: a text that is not valid FLM fails
the build with a message that identifies the text. The standard features
take it as
StdlibConfig::citations.
The citation counter style is the feature’s own: the counter styles a host
sets in the numbering feature’s configuration
(NumberingConfig::styles)
do not replace it, and a host changes it here.
§Examples
use flm_core::stdlib::features::citations::{CitationsConfig, MarkForm};
use flm_core::stdlib::features::numbering::Delimiters;
let mut config = CitationsConfig::new().mark(MarkForm::Superscript);
config.style.delimiters = Delimiters::new("(", ")");
assert_eq!(config.note_separator, "; ");
assert!(config.style.ranges);
assert_eq!(config.heading_title.as_deref(), Some("References"));
// The list with no heading above it.
assert_eq!(CitationsConfig::new().without_heading().heading_title, None);Fields§
§placement: CitationPlacementWhere the citation entries are shown: listed after the content, the
default, or in the citation marks in place of the numbers
(CitationPlacement).
mark: MarkFormHow a citation mark shows its numbers under the listed placement, and
how the list of cited works labels its entries: MarkForm::Bracketed
by default. It has no effect under CitationPlacement::InPlace.
style: CounterStyleDeclThe citation counter style, a counter style
(CounterStyleDecl): how a number is written, the delimiters, the
texts joining several numbers, whether consecutive numbers make a
range, and the words \R writes before a citation mark. By default
(default_style): arabic numbers, [ and ], the compact join,
ranges on, the words ref.~ and refs.~, and the variant capital
with the words Ref.~ and Refs.~.
In settings data, the fields written replace those of the default
citation counter style, and the name is not written: it is always
STYLE_NAME.
heading_title: Option<String>The title of the heading above the list of cited works, as FLM text:
References by default; None for a list with no heading above it
(without_heading).
heading_level: u8The level of the heading above the list of cited works, counted from zero like every heading level; 2 by default, the level of the heading above a list of footnotes. The feature passes it to the heading unchanged, and accepts every value. It has no effect on a list with no heading.
note_separator: StringThe text written between a group’s numbers and its note, as FLM text:
; by default, as in [1; Thm 4].
Implementations§
Source§impl CitationsConfig
impl CitationsConfig
Sourcepub fn new() -> CitationsConfig
pub fn new() -> CitationsConfig
Returns the default configuration: the citation entries listed, the
bracketed form, the default citation counter style (default_style), the
title References at level 2, and ; before a note.
Sourcepub fn placement(self, placement: CitationPlacement) -> CitationsConfig
pub fn placement(self, placement: CitationPlacement) -> CitationsConfig
Builder: sets placement.
Sourcepub fn mark(self, mark: MarkForm) -> CitationsConfig
pub fn mark(self, mark: MarkForm) -> CitationsConfig
Builder: sets mark.
Sourcepub fn style(self, style: CounterStyleDecl) -> CitationsConfig
pub fn style(self, style: CounterStyleDecl) -> CitationsConfig
Builder: sets style, the citation counter style.
The name of style is used as given.
Sourcepub fn heading_title(self, title: impl Into<String>) -> CitationsConfig
pub fn heading_title(self, title: impl Into<String>) -> CitationsConfig
Builder: sets heading_title, the
title of the heading above the list of cited works.
Sourcepub fn without_heading(self) -> CitationsConfig
pub fn without_heading(self) -> CitationsConfig
Builder: no heading above the list of the cited works.
Sourcepub fn heading_level(self, level: u8) -> CitationsConfig
pub fn heading_level(self, level: u8) -> CitationsConfig
Builder: sets heading_level.
Sourcepub fn note_separator(self, separator: impl Into<String>) -> CitationsConfig
pub fn note_separator(self, separator: impl Into<String>) -> CitationsConfig
Builder: sets note_separator.
Sourcepub fn digest_bytes(&self) -> Vec<u8> ⓘ
pub fn digest_bytes(&self) -> Vec<u8> ⓘ
Returns the bytes the feature gives to the registry digest
(FeatureBuilder::digest_input):
the placement, the form, every field of the citation counter style as the
numbering feature writes a counter style’s, whether the list has a
heading and its title, the note separator and the heading’s level, each
text preceded by its length.
Trait Implementations§
Source§impl Clone for CitationsConfig
impl Clone for CitationsConfig
Source§impl Debug for CitationsConfig
impl Debug for CitationsConfig
Source§impl Default for CitationsConfig
impl Default for CitationsConfig
Source§fn default() -> CitationsConfig
fn default() -> CitationsConfig
Source§impl<'de> Deserialize<'de> for CitationsConfigwhere
CitationsConfig: Default,
impl<'de> Deserialize<'de> for CitationsConfigwhere
CitationsConfig: 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 CitationsConfig
Source§impl Hash for CitationsConfig
impl Hash for CitationsConfig
Source§impl JsonSchema for CitationsConfig
impl JsonSchema for CitationsConfig
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 CitationsConfig
impl PartialEq for CitationsConfig
impl StructuralPartialEq for CitationsConfig
Auto Trait Implementations§
impl Forget for CitationsConfig
impl Freeze for CitationsConfigwhere
*const ArcInner<str> is !null: Freeze,
PhantomData<ArcInner<str>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<SubLevelDecl>: Freeze,
*const LeafNode<String, PluralWords> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, PluralWords)>>: Freeze,
impl Move for CitationsConfig
impl RefUnwindSafe for CitationsConfig
impl Send for CitationsConfigwhere
Arc<str>: Send,
RawVecInner: Send,
NodeRef<Owned, String, PluralWords, LeafOrInternal>: Send,
BoxRaw<(String, PluralWords)>: Send,
impl Sync for CitationsConfigwhere
Arc<str>: Sync,
RawVecInner: Sync,
NodeRef<Owned, String, PluralWords, LeafOrInternal>: Sync,
BoxRaw<(String, PluralWords)>: Sync,
impl Unpin for CitationsConfig
impl UnsafeUnpin for CitationsConfigwhere
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<SubLevelDecl>: UnsafeUnpin,
*const LeafNode<String, PluralWords> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, PluralWords)>>: UnsafeUnpin,
impl UnwindSafe for CitationsConfig
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