bdarcus / csln

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

Affix modeling #108

Open bdarcus opened 12 months ago

bdarcus commented 12 months 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 11 months ago

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