summaryrefslogtreecommitdiff
path: root/subplot
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-12-04 09:56:46 +0200
committerLars Wirzenius <liw@liw.fi>2022-12-04 09:56:46 +0200
commita2bb3de4db8b4cb7ab325511e9cbf0450f843295 (patch)
tree23bf3d50fba1d70220b670782c1e6fe6ca71d03a /subplot
parent2b978041bd59f539a2990778e8e18015a63341fe (diff)
downloadriki-a2bb3de4db8b4cb7ab325511e9cbf0450f843295.tar.gz
fix: handle optional title in image links
Sponsored-by: author
Diffstat (limited to 'subplot')
-rw-r--r--subplot/riki.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/subplot/riki.rs b/subplot/riki.rs
index 722b597..9575b55 100644
--- a/subplot/riki.rs
+++ b/subplot/riki.rs
@@ -81,6 +81,8 @@ impl MutVisitor for DropImageFigTitle {
if let Inline::Image(attr, alt, target) = inline {
if target.1 == "fig:" {
*inline = Inline::Image(attr.clone(), alt.to_vec(), (target.0.clone(), "".into()));
+ } else if let Some(rest) = target.1.strip_prefix("fig:") {
+ *inline = Inline::Image(attr.clone(), alt.to_vec(), (target.0.clone(), rest.into()));
}
}
}