diff options
Diffstat (limited to 'src/doc.rs')
-rw-r--r-- | src/doc.rs | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -5,6 +5,7 @@ use crate::html::Attribute; use crate::html::HtmlPage; use crate::html::{Content, Element, ElementTag}; use crate::md::Markdown; +use crate::resource; use crate::EmbeddedFile; use crate::EmbeddedFiles; use crate::MatchedScenario; @@ -25,6 +26,9 @@ use std::path::{Path, PathBuf}; use log::{error, trace}; +/// Name of standard Subplot CSS file. +const CSS: &str = "subplot.css"; + /// The set of known (special) classes which subplot will always recognise /// as being valid. static SPECIAL_CLASSES: &[&str] = &[ @@ -140,13 +144,8 @@ impl Document { /// Return Document as an HTML page serialized into HTML text pub fn to_html(&mut self, date: &str) -> Result<String, SubplotError> { - const CSS: &str = r#" - div.toc ol { - list-style-type: none; - padding: 0; - padding-inline-start: 2ch; - } - "#; + let css_file = resource::read_as_string(CSS, None) + .map_err(|e| SubplotError::CssFileNotFound(CSS.into(), e))?; let mut head = Element::new(crate::html::ElementTag::Head); let mut title = Element::new(crate::html::ElementTag::Title); @@ -154,7 +153,7 @@ impl Document { head.push_child(crate::html::Content::Elt(title)); let mut css = Element::new(ElementTag::Style); - css.push_child(Content::Text(CSS.into())); + css.push_child(Content::Text(css_file)); for css_file in self.meta.css_embed() { css.push_child(Content::Text(css_file.into())); } |