summaryrefslogtreecommitdiff
path: root/src/doc.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-10-30 18:55:47 +0200
committerLars Wirzenius <liw@liw.fi>2023-10-30 19:12:15 +0200
commitad26e9d84925532ae5522aad8def5d764fe0ffbe (patch)
tree0fd717f54feddf2975ff134d2f32c343dc2cc28b /src/doc.rs
parent5a84e1bde773bdc782c1db5a633ef8765f220253 (diff)
downloadsubplot-ad26e9d84925532ae5522aad8def5d764fe0ffbe.tar.gz
feat: allow adding CSS URLs to HTML output
This is in the meta data field "css_urls". Signed-off-by: Lars Wirzenius <liw@liw.fi> Sponsored-by: author
Diffstat (limited to 'src/doc.rs')
-rw-r--r--src/doc.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/doc.rs b/src/doc.rs
index 83b5ec2..7e80deb 100644
--- a/src/doc.rs
+++ b/src/doc.rs
@@ -160,6 +160,14 @@ impl Document {
}
head.push_child(Content::Elt(css));
+ for css_url in self.meta.css_urls() {
+ let mut link = Element::new(ElementTag::Link);
+ link.push_attribute(Attribute::new("rel", "stylesheet"));
+ link.push_attribute(Attribute::new("type", "text/css"));
+ link.push_attribute(Attribute::new("href", css_url));
+ head.push_child(Content::Elt(link));
+ }
+
self.meta.set_date(date.into());
let mut body_content = Element::new(crate::html::ElementTag::Div);