diff --git a/src/processors/mod.rs b/src/processors/mod.rs index 50c9a75..9b70f2b 100644 --- a/src/processors/mod.rs +++ b/src/processors/mod.rs @@ -1,8 +1,9 @@ use config::Config; -pub mod head_cleanup; -pub mod strip_blank; +mod head_cleanup; +mod strip_blank; +mod rebrand; -pub const PROCESSORS: [fn(Config, String) -> Result; 2] = - [head_cleanup::head_cleanup, strip_blank::strip_blank]; +pub const PROCESSORS: [fn(Config, String) -> Result; 3] = + [head_cleanup::head_cleanup, rebrand::rebrand, strip_blank::strip_blank]; diff --git a/src/processors/rebrand.rs b/src/processors/rebrand.rs new file mode 100644 index 0000000..2f03db8 --- /dev/null +++ b/src/processors/rebrand.rs @@ -0,0 +1,11 @@ +use html::{sciter_start, get_html, get_head, find_first}; +use config::Config; + + +pub fn rebrand(config: Config, input: String) -> Result { + let mut root = sciter_start(input); + let mut head = get_head(&mut root); + let mut ele = find_first(&mut root, "meta[name='generator']"); + ele.set_attribute("content", crate_name!()); + return Ok(get_html(root)); +}