Skip to content

Commit

Permalink
Merge branch 'main' into csl-page
Browse files Browse the repository at this point in the history
  • Loading branch information
DerDrodt committed Apr 23, 2024
2 parents 015b6bc + 858782e commit 308bc55
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "citationberg"
version = "0.1.1"
version = "0.3.0"
authors = ["Martin Haug <[email protected]>"]
license = "MIT OR Apache-2.0"
description = "A parser for CSL files"
Expand All @@ -16,7 +16,7 @@ default = []
json = ["unscanny"] # adds support for CSL-json parsing

[dependencies]
quick-xml = { version = "0.28", features = ["serialize", "overlapped-lists"] }
quick-xml = { version = "0.31", features = ["serialize", "overlapped-lists"] }
serde = { version = "1.0", features = ["derive"] }
unscanny = { version = "0.1.0", optional = true }

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A library for parsing CSL styles.

```toml
[dependencies]
citationberg = "0.1"
citationberg = "0.3"
```

Citationberg deserializes CSL styles from XML into Rust structs. It supports
Expand Down
2 changes: 1 addition & 1 deletion src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ pub struct CitationItem {
pub locator: Option<String>,
/// What kind of locator to use (e.g. `"page"`).
pub label: Option<String>,
/// Whether to supress the author for this item.
/// Whether to suppress the author for this item.
#[serde(default)]
pub suppress_author: bool,
/// Something to print before this item.
Expand Down
19 changes: 11 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ pub enum StyleClass {
pub enum PageRangeFormat {
/// “321–28”
/// Aliases: `chicago` until CSL 1.1
// Rename needed because the number is not used as word boundry by heck.
// Rename needed because the number is not used as word boundary by heck.
#[serde(alias = "chicago")]
#[serde(rename = "chicago-15")]
Chicago15,
Expand Down Expand Up @@ -1059,7 +1059,7 @@ pub struct Citation {
)]
pub disambiguate_add_givenname: bool,
/// When to expand names that are ambiguous in short form.
#[serde(rename = "@disambiguate-add-givenname-rule", default)]
#[serde(rename = "@givenname-disambiguation-rule", default)]
pub givenname_disambiguation_rule: DisambiguationRule,
/// Disambiguate by adding more names that would otherwise be hidden by et al.
///
Expand Down Expand Up @@ -1284,7 +1284,7 @@ pub enum SubsequentAuthorSubstituteRule {
CompleteAll,
/// When all names match, replace each name.
CompleteEach,
/// Each maching name is replaced.
/// Each matching name is replaced.
PartialEach,
/// Only the first matching name is replaced.
PartialFirst,
Expand Down Expand Up @@ -2189,7 +2189,7 @@ impl Names {
}

/// Convert a [`Names`] within a substitute to a name using the parent element.
pub fn from_names_substitue(&self, child: &Self) -> Names {
pub fn from_names_substitute(&self, child: &Self) -> Names {
if child.name().is_some()
|| child.et_al().is_some()
|| child.substitute().is_some()
Expand Down Expand Up @@ -2520,9 +2520,12 @@ impl NameOptions<'_> {
return false;
}

// If this is a subsequnt citation of the same item, use other CSL options
// If this is a subsequent citation of the same item, use other CSL options, if they exist
let (et_al_min, et_al_use_first) = if is_subsequent {
(self.et_al_subsequent_min, self.et_al_subsequent_use_first)
(
self.et_al_subsequent_min.or(self.et_al_min),
self.et_al_subsequent_use_first.or(self.et_al_use_first),
)
} else {
(self.et_al_min, self.et_al_use_first)
};
Expand Down Expand Up @@ -2552,7 +2555,7 @@ pub enum DelimiterBehavior {
/// (`-precedes-last`) names.
#[default]
Contextual,
/// Only use if the preceeding name is inverted (per `name-as-sort-order`).
/// Only use if the preceding name is inverted (per `name-as-sort-order`).
AfterInvertedName,
/// Always use the delimiter for this condition.
Always,
Expand Down Expand Up @@ -3638,7 +3641,7 @@ mod test {
}

/// Be sure to check out the CSL
/// [styles](https://github.com/citation-style-language/locales) repository
/// [styles](https://github.com/citation-style-language/styles) repository
/// into a sibling folder to run this test.
#[test]
fn roundtrip_cbor_all() {
Expand Down
3 changes: 2 additions & 1 deletion src/taxonomy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub enum StandardVariable {
CallNumber,
/// Identifier of the item in the input data file (analogous to BibTeX
/// entrykey); Use this variable to facilitate conversion between
/// word-processor and plain-text writing systems; For an identifer intended
/// word-processor and plain-text writing systems; For an identifier intended
/// as formatted output label for a citation (e.g. “Ferr78”), use
/// citation-label instead.
CitationKey,
Expand Down Expand Up @@ -296,6 +296,7 @@ pub enum NumberVariable {
/// journal article); Use part-title for the title of the part, if any.
PartNumber,
/// Printing number of the item or container holding the item.
#[serde(alias = "printing")]
PrintingNumber,
/// Section of the item or container holding the item (e.g. “§2.0.1” for a
/// law; “politics” for a newspaper article).
Expand Down
2 changes: 1 addition & 1 deletion tests/independent/chicago-fullnote-bibliography.csl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
</names>
</if>
</choose>
<!--This includes page numers after the container author, e.g. for Introductions -->
<!--This includes page numbers after the container author, e.g. for Introductions -->
<choose>
<if variable="container-author author" match="all">
<group delimiter=". ">
Expand Down

0 comments on commit 308bc55

Please sign in to comment.