Change generator message
This commit is contained in:
parent
bb43ebad70
commit
9cd4f124d0
2 changed files with 16 additions and 4 deletions
|
@ -1,8 +1,9 @@
|
||||||
use config::Config;
|
use config::Config;
|
||||||
|
|
||||||
pub mod head_cleanup;
|
mod head_cleanup;
|
||||||
pub mod strip_blank;
|
mod strip_blank;
|
||||||
|
mod rebrand;
|
||||||
|
|
||||||
|
|
||||||
pub const PROCESSORS: [fn(Config, String) -> Result<String, String>; 2] =
|
pub const PROCESSORS: [fn(Config, String) -> Result<String, String>; 3] =
|
||||||
[head_cleanup::head_cleanup, strip_blank::strip_blank];
|
[head_cleanup::head_cleanup, rebrand::rebrand, strip_blank::strip_blank];
|
||||||
|
|
11
src/processors/rebrand.rs
Normal file
11
src/processors/rebrand.rs
Normal file
|
@ -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<String, String> {
|
||||||
|
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));
|
||||||
|
}
|
Reference in a new issue