Merge dc1c1ebb8fcbe8e26005664bdec1c51beeb56a22 into d1deb80bb8b4d5fad348c23a3e079e4854aa57e4

This commit is contained in:
Wojciech Kordalski 2025-07-05 21:57:19 +08:00 committed by GitHub
commit 7ce5486469
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 6 deletions

6
Cargo.lock generated
View File

@ -327,8 +327,7 @@ dependencies = [
[[package]]
name = "citationberg"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4595e03beafb40235070080b5286d3662525efc622cca599585ff1d63f844fa"
source = "git+https://github.com/typst/citationberg.git?rev=67db988c7155f17b2e0aff9aabcd9a00745e4c04#67db988c7155f17b2e0aff9aabcd9a00745e4c04"
dependencies = [
"quick-xml 0.36.2",
"serde",
@ -946,8 +945,7 @@ dependencies = [
[[package]]
name = "hayagriva"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "954907554bb7fcba29a4f917c2d43e289ec21b69d872ccf97db160eca6caeed8"
source = "git+https://github.com/wkordalski/hayagriva.git?branch=transparent-locator-payload-with-discrimination-ids#63c73bd163b997218fccd2713bdbf211bc7051cb"
dependencies = [
"biblatex",
"ciborium",

View File

@ -162,3 +162,6 @@ manual_range_contains = "allow"
mutable_key_type = "allow"
uninlined_format_args = "warn"
wildcard_in_or_patterns = "allow"
[patch.crates-io]
hayagriva = { git = "https://github.com/wkordalski/hayagriva.git", branch = "transparent-locator-payload-with-discrimination-ids" }

View File

@ -663,6 +663,9 @@ impl<'a> Generator<'a> {
let database = &self.bibliography.sources.derived;
let bibliography_style = &self.bibliography.style(StyleChain::default()).derived;
let mut supplement_ids = HashMap::new();
let mut next_supplement_id: u64 = 0;
// Process all citation groups.
let mut driver = BibliographyDriver::new();
for elem in &self.groups {
@ -690,10 +693,16 @@ impl<'a> Generator<'a> {
};
let supplement = child.supplement(StyleChain::default());
let locator = supplement.as_ref().map(|_| {
let locator = supplement.as_ref().map(|c| {
let id = *supplement_ids.entry(c.plain_text()).or_insert_with(|| {
let id = next_supplement_id;
next_supplement_id += 1;
id
});
SpecificLocator(
citationberg::taxonomy::Locator::Custom,
hayagriva::LocatorPayload::Transparent,
hayagriva::LocatorPayload::Transparent(id),
)
});