Crate citationberg

source ·
Expand description

A library for parsing CSL styles.

Citationberg deserializes CSL styles from XML into Rust structs. It supports CSL 1.0.2.

This crate is not a CSL processor, so you are free to choose whatever data model and data types you need for your bibliographic needs. If you need to render citations, you can use Hayagriva which uses this crate under the hood.

Parse your style like this:

use std::fs;
use citationberg::Style;

let string = fs::read_to_string("tests/independent/ieee.csl")?;
let style = citationberg::Style::from_xml(&string)?;

let Style::Independent(independent) = style else {
    panic!("IEEE is an independent style");
};

assert_eq!(independent.info.title.value, "IEEE");

You can also parse a DependentStyle or a IndependentStyle directly.

Modules§

  • CSL constants that describe entries, terms, and variables.

Structs§

Enums§

Traits§

  • Allow every struct with affix properties to convert to a Affixes.
  • Allow every struct with formatting properties to convert to a Formatting.

Type Aliases§

  • Error type for functions that serialize and deserialize XML.
  • Result type for functions that serialize and deserialize XML.