Add structure for post-processing renderers

This commit is contained in:
Jake Howard 2017-08-15 22:00:56 +01:00
parent 451488966c
commit 78c5bacd4b
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 20 additions and 2 deletions

View file

@ -1,9 +1,11 @@
pub mod pandoc;
pub mod render;
use config::Config;
pub fn build_input(config: Config, input: String) -> Result<String, String> {
let html = try!(pandoc::render(config, input));
return Ok(html);
let html = try!(pandoc::render(config.clone(), input));
let rendered = try!(render::render(config.clone(), html));
return Ok(rendered);
}

16
src/build/render.rs Normal file
View file

@ -0,0 +1,16 @@
use config::Config;
fn stub(config: Config, input: String) -> Result<String, String> {
return Ok(input);
}
pub fn render(config: Config, input: String) -> Result<String, String> {
let mut rendered_input = input;
for renderer in vec![
stub
] {
rendered_input = try!(renderer(config.clone(), rendered_input));
}
return Ok(rendered_input);
}