Add styles to output document

This commit is contained in:
Jake Howard 2017-11-26 21:46:28 +00:00
parent 5e1451f7ca
commit d170372e5a
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 22 additions and 2 deletions

View file

@ -5,13 +5,14 @@ mod strip_blank;
mod rebrand;
mod references;
mod images;
mod static_files;
pub const PROCESSORS: [fn(Config, String) -> Result<String, String>; 5] =
pub const PROCESSORS: [fn(Config, String) -> Result<String, String>; 6] =
[
head_cleanup::head_cleanup,
rebrand::rebrand,
references::references,
images::images,
static_files::static_files,
strip_blank::strip_blank,
];

View file

@ -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<String, String> {
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));
}