From b078cc6b71b055250a067371e52ce0a5dd6e8c9c Mon Sep 17 00:00:00 2001 From: Martin Haug Date: Sun, 19 May 2024 21:15:10 +0200 Subject: [PATCH 1/3] Clippy! --- src/selectors/mod.rs | 2 +- src/types/numeric.rs | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/selectors/mod.rs b/src/selectors/mod.rs index 9c3532d..8ce1523 100644 --- a/src/selectors/mod.rs +++ b/src/selectors/mod.rs @@ -228,7 +228,7 @@ impl Selector { Self::Binding(binding, expr) => { expr.apply_any(entries).map(|(mut bound, es)| { if !es.is_empty() { - bound.insert(binding.to_string(), es.get(0).unwrap()); + bound.insert(binding.to_string(), es.first().unwrap()); } (bound, vec![]) }) diff --git a/src/types/numeric.rs b/src/types/numeric.rs index 2c3f901..cd1be5b 100644 --- a/src/types/numeric.rs +++ b/src/types/numeric.rs @@ -386,15 +386,14 @@ impl NumericValue { let end = vec[1].0; let first_delim = vec[0].1; - if start < end - && (first_delim == Some(NumericDelimiter::Hyphen) - || (first_delim == Some(NumericDelimiter::Ampersand) - && start + 1 == end)) + let first_delim_ampersand_range = first_delim + == Some(NumericDelimiter::Ampersand) + && start + 1 == end; + + if (first_delim_ampersand_range) + || first_delim == Some(NumericDelimiter::Hyphen) { Some(start..=end) - } else if first_delim == Some(NumericDelimiter::Hyphen) { - // Handle shorthand notation like `100-4` for `100-104` - Some(start..=end) } else { None } From 78bb4784f33241df4d730f6cffb017292638c87f Mon Sep 17 00:00:00 2001 From: PgBiel <9021226+PgBiel@users.noreply.github.com> Date: Mon, 5 Aug 2024 22:41:02 -0300 Subject: [PATCH 2/3] Fix CI (#197) --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index ae6983c..ac18748 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ archive = ["ciborium"] csl-json = ["citationberg/json"] [dependencies] -citationberg = { git = "https://github.com/typst/citationberg.git", rev = "858782e" } +citationberg = { git = "https://github.com/typst/citationberg.git", rev = "61ca6a7fcc48365f805e521cc8bc1f8f679ff372" } indexmap = { version = "2.0.2", features = ["serde"] } numerals = "0.1.4" paste = "1.0.14" From af287f853e97ad7d6ee8cc26fe0e582a98702187 Mon Sep 17 00:00:00 2001 From: PgBiel <9021226+PgBiel@users.noreply.github.com> Date: Mon, 5 Aug 2024 22:46:02 -0300 Subject: [PATCH 3/3] Don't force space after sort separator (#195) --- src/csl/rendering/names.rs | 4 ---- tests/citeproc-pass.txt | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/csl/rendering/names.rs b/src/csl/rendering/names.rs index a0113f5..3c93675 100644 --- a/src/csl/rendering/names.rs +++ b/src/csl/rendering/names.rs @@ -654,7 +654,6 @@ fn write_name( if name.given_name.is_some() { ctx.push_str(sort_sep); - ctx.ensure_space(); let idx = ctx.push_format(first_format); let cidx = ctx.push_case(first_case); @@ -680,7 +679,6 @@ fn write_name( if let Some(suffix) = &name.suffix { ctx.push_str(sort_sep); - ctx.ensure_space(); ctx.push_str(suffix); } }; @@ -704,7 +702,6 @@ fn write_name( if name.given_name.is_some() { ctx.push_str(sort_sep); - ctx.ensure_space(); let idx = ctx.push_format(first_format); let cidx = ctx.push_case(first_case); @@ -735,7 +732,6 @@ fn write_name( if let Some(suffix) = &name.suffix { ctx.push_str(sort_sep); - ctx.ensure_space(); ctx.push_str(suffix); } }; diff --git a/tests/citeproc-pass.txt b/tests/citeproc-pass.txt index 0853321..fcbbe72 100644 --- a/tests/citeproc-pass.txt +++ b/tests/citeproc-pass.txt @@ -262,6 +262,7 @@ nameattr_NameFormOnNamesInCitation nameattr_NameFormOnStyleInCitation nameattr_NamesDelimiterOnBibliographyInCitation nameattr_NamesDelimiterOnNamesInCitation +nameattr_SortSeparatorOnBibliographyInCitation nameattr_SortSeparatorOnCitationInCitation nameattr_SortSeparatorOnNamesInCitation nameattr_SortSeparatorOnStyleInCitation @@ -302,6 +303,7 @@ sort_DateVariableMixedElementsDescendingB sort_LatinUnicode sort_LocalizedDateLimitedParts sort_TestInheritance +sortseparator_SortSeparatorEmpty substitute_RepeatedNamesOk substitute_SubstituteOnlyOnceString substitute_SubstituteOnlyOnceTerm