diff --git a/src/processors/mod.rs b/src/processors/mod.rs index 16d0631..fb43c3d 100644 --- a/src/processors/mod.rs +++ b/src/processors/mod.rs @@ -5,13 +5,14 @@ mod strip_blank; mod rebrand; mod references; mod images; +mod static_files; - -pub const PROCESSORS: [fn(Config, String) -> Result; 5] = +pub const PROCESSORS: [fn(Config, String) -> Result; 6] = [ head_cleanup::head_cleanup, rebrand::rebrand, references::references, images::images, + static_files::static_files, strip_blank::strip_blank, ]; diff --git a/src/processors/static_files.rs b/src/processors/static_files.rs new file mode 100644 index 0000000..32ce8e9 --- /dev/null +++ b/src/processors/static_files.rs @@ -0,0 +1,19 @@ +use html::{sciter_start, get_html, get_head, find_first}; +use sciter::Element; +use config::Config; +use assets; + +fn create_css_element(style: String) -> Element { + let mut style_tag = Element::with_text("style", &style).unwrap(); + style_tag.set_attribute("type", "text/css"); + style_tag.set_attribute("media", "all"); + return style_tag; +} + + +pub fn static_files(_: Config, input: String) -> Result { + let mut root = sciter_start(input); + let mut head = get_head(&mut root); + head.append(&create_css_element(assets::get("style.css"))); + return Ok(get_html(root)); +}