diff --git a/src/build/render.rs b/src/build/render.rs index c220160..8b1eb92 100644 --- a/src/build/render.rs +++ b/src/build/render.rs @@ -1,10 +1,10 @@ use config::Config; -use renderers::stub; +use renderers::html_cleanup::html_cleanup; pub fn render(config: Config, input: String) -> Result { let mut rendered_input = input; - for renderer in vec![stub] { + for renderer in vec![html_cleanup] { rendered_input = try!(renderer(config.clone(), rendered_input)); } return Ok(rendered_input); diff --git a/src/renderers/sciter.rs b/src/renderers/helpers.rs similarity index 100% rename from src/renderers/sciter.rs rename to src/renderers/helpers.rs diff --git a/src/renderers/html_cleanup.rs b/src/renderers/html_cleanup.rs new file mode 100644 index 0000000..6f20b23 --- /dev/null +++ b/src/renderers/html_cleanup.rs @@ -0,0 +1,13 @@ +use renderers::helpers::{sciter_start, get_html}; +use config::Config; + + +pub fn html_cleanup(config: Config, input: String) -> Result { + let mut root = sciter_start(input); + root.find_first("meta[content='text/css']").unwrap().unwrap().destroy().unwrap(); + root.find_first("style").unwrap().unwrap().destroy().unwrap(); + root.find_first("title").unwrap().unwrap().destroy().unwrap(); + let html = get_html(root); + return Ok(html); +} + diff --git a/src/renderers/mod.rs b/src/renderers/mod.rs index f589f2d..6537b51 100644 --- a/src/renderers/mod.rs +++ b/src/renderers/mod.rs @@ -1,10 +1,5 @@ use config::Config; -pub mod sciter; - -pub fn stub(config: Config, input: String) -> Result { - let root = sciter::sciter_start(input); - let html = sciter::get_html(root); - return Ok(html); -} +mod helpers; +pub mod html_cleanup;