mirror of
https://github.com/typst/typst
synced 2025-05-13 20:46:23 +08:00
Merge 8f062997d1ec811a608d6d8cd41ef5a4b36e0d5d into 9b09146a6b5e936966ed7ee73bce9dd2df3810ae
This commit is contained in:
commit
742f1f6dc0
3
Cargo.lock
generated
3
Cargo.lock
generated
@ -947,8 +947,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#3014bc205549e66c0fec2b74612c07c5b67a6f49"
|
||||
dependencies = [
|
||||
"biblatex",
|
||||
"ciborium",
|
||||
|
@ -160,3 +160,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" }
|
||||
|
@ -638,6 +638,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 {
|
||||
@ -665,10 +668,24 @@ impl<'a> Generator<'a> {
|
||||
};
|
||||
|
||||
let supplement = child.supplement(StyleChain::default());
|
||||
let locator = supplement.as_ref().map(|_| {
|
||||
let locator = supplement.as_ref().map(|c| {
|
||||
// let mut hasher = DefaultHasher::new();
|
||||
// c.hash(&mut hasher);
|
||||
// let content_hash = hasher.finish();
|
||||
|
||||
let plain_text = c.plain_text();
|
||||
// println!("plain_text: {}", plain_text);
|
||||
// println!("{c:?}");
|
||||
|
||||
let id = *supplement_ids.entry(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),
|
||||
)
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user