Annotate ORCID author badges with their profile links

This commit is contained in:
gloamxun committed 2026-10-19 21:37:17 +08:00
1 parent 05d7980561
commit 2076da8f21
8 files changed
+52 -10

No files matched your search

+2
View File
@@ -101,6 +101,7 @@ pub struct DocumentModel {
pub citation_metadata: HashMap<String, CitationMetadata>,
/// Display text -> hyperlink URL for `\href` annotations.
pub link_targets: HashMap<String, String>,
pub orcid_urls: Vec<String>,
/// Bibliography keys in the order their metadata was declared. Needed to
/// assign natbib-style year suffixes (2014a, 2014b, ...) deterministically.
pub bibliography_order: Vec<String>,
@@ -131,6 +132,7 @@ impl Default for DocumentModel {
citations: HashMap::new(),
citation_metadata: HashMap::new(),
link_targets: HashMap::new(),
orcid_urls: Vec::new(),
bibliography_order: Vec::new(),
author_year_citations: false,
footnotes: Vec::new(),
@@ -1156,6 +1156,9 @@ impl Parser {
self.link_depth = self.link_depth.saturating_add(1);
}
expanded::FrontendEventKind::LinkTarget { text, url } => {
if url.contains("orcid.org") {
self.document.orcid_urls.push(url.clone());
}
self.document.link_targets.insert(text.clone(), url.clone());
}
expanded::FrontendEventKind::LinkEnd => {