bdarcus / csln

Reimagining CSL
Mozilla Public License 2.0
13 stars 0 forks source link

Affix modeling #108

Open bdarcus opened 1 year ago

bdarcus commented 1 year ago

I started to work on this, but think I'll defer.

Ideally, should be able to separately format them from main content, per below, though that does add complexity.

#[derive(Debug, Deserialize, Serialize, Clone, JsonSchema, PartialEq)]
pub struct Affix {
    pub content: AffixContent,
    pub wrap: Option<WrapPunctuation>,
    pub rendering: Option<Rendering>,
}

#[derive(Debug, Deserialize, Serialize, Clone, JsonSchema, PartialEq)]
/// A literal string or localized term to be added to the beginning or end of a rendered component.
pub enum AffixContent {
    Literal(String),
    Term(String),
}

A more limited alternative would just be to turn off formatting of the prefix or suffix.

bdarcus commented 1 year ago

See also #118, and note about using djot for field formatting.