Actually clean everything up...
This commit is contained in:
parent
14e46489ab
commit
714e944d93
1 changed files with 10 additions and 6 deletions
|
@ -1,12 +1,16 @@
|
||||||
use renderers::{sciter_start, get_html, destroy_matching};
|
use renderers::{sciter_start, get_html, destroy_matching, destroy_at, find_first};
|
||||||
use config::Config;
|
use config::Config;
|
||||||
|
use sciter::{Window};
|
||||||
|
use std::ops::Deref;
|
||||||
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
|
||||||
pub fn html_cleanup(config: Config, input: String) -> Result<String, String> {
|
pub fn html_cleanup(config: Config, input: String) -> Result<String, String> {
|
||||||
let mut root = sciter_start(input);
|
let mut root = sciter_start(input);
|
||||||
destroy_matching(&mut root, "meta[content='text/css']");
|
let mut head = find_first(&mut root, "head");
|
||||||
destroy_matching(&mut root, "style");
|
destroy_at(&mut head, 4); // Sciter doesnt like finding this style tag for some reason
|
||||||
destroy_matching(&mut root, "title");
|
destroy_matching(&mut head, "meta[content='text/css']");
|
||||||
let html = get_html(root);
|
destroy_matching(&mut head, "style");
|
||||||
return Ok(html);
|
destroy_matching(&mut head, "title");
|
||||||
|
return Ok(get_html(root));
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue