archive
/
md-pdf-rs
Archived
1
Fork 0

Change generator message

This commit is contained in:
Jake Howard 2017-09-06 20:07:06 +01:00
parent bb43ebad70
commit 9cd4f124d0
Signed by: jake
GPG Key ID: 57AFB45680EDD477
2 changed files with 16 additions and 4 deletions

View File

@ -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<String, String>; 2] =
[head_cleanup::head_cleanup, strip_blank::strip_blank];
pub const PROCESSORS: [fn(Config, String) -> Result<String, String>; 3] =
[head_cleanup::head_cleanup, rebrand::rebrand, strip_blank::strip_blank];

11
src/processors/rebrand.rs Normal file
View 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));
}