Annotate ORCID author badges with their profile links
This commit is contained in:
1 parent
05d7980561
commit
2076da8f21
8 files changed
+52
-10
No files matched your search
+15
-1
@@ -361,6 +361,7 @@ enum PositionedPageItem {
|
||||
Badge {
|
||||
x: i64,
|
||||
y: i64,
|
||||
url: Option<String>,
|
||||
},
|
||||
FramedBox {
|
||||
anchor: PageAnchor,
|
||||
@@ -580,6 +581,19 @@ impl PositionedPages {
|
||||
link_targets,
|
||||
);
|
||||
}
|
||||
PositionedPageItem::Badge {
|
||||
x,
|
||||
y,
|
||||
url: Some(url),
|
||||
} => {
|
||||
let left = scaled_units_to_mm(*x);
|
||||
let bottom = page_height_mm - (scaled_units_to_mm(*y) + 4.0);
|
||||
annotations.push(LinkAnnotation {
|
||||
page: index as u32 + 1,
|
||||
rect: [left, bottom, left + 4.0, bottom + 4.0],
|
||||
url: url.clone(),
|
||||
});
|
||||
}
|
||||
PositionedPageItem::Centered { element, y, .. } => {
|
||||
let font_size = 11;
|
||||
let em = f64::from(font_size) * 25.4 / 72.27;
|
||||
@@ -791,7 +805,7 @@ impl Element for PositionedPages {
|
||||
y,
|
||||
)
|
||||
}
|
||||
PositionedPageItem::Badge { x, y } => {
|
||||
PositionedPageItem::Badge { x, y, .. } => {
|
||||
let x = scaled_units_to_mm(*x);
|
||||
let y = scaled_units_to_mm(*y);
|
||||
let mut badge_area = body_area.clone();
|
||||
|
||||
@@ -2023,6 +2023,7 @@ pub(super) fn build_positioned_pages(
|
||||
.push(PositionedPageItem::Badge {
|
||||
x: millimeters_to_scaled(line_x),
|
||||
y: badge_y,
|
||||
url: model.orcid_urls.get(column).cloned(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ fn page_svg(
|
||||
monospace_family,
|
||||
sans_family,
|
||||
),
|
||||
PositionedPageItem::Badge { x, y } => write_badge(&mut output, *x, *y),
|
||||
PositionedPageItem::Badge { x, y, .. } => write_badge(&mut output, *x, *y),
|
||||
PositionedPageItem::Image { element, y, .. } => write_figure(
|
||||
&mut output,
|
||||
element,
|
||||
|
||||
Reference in new issue
Block a user