Add structure for post-processing renderers
This commit is contained in:
parent
451488966c
commit
78c5bacd4b
2 changed files with 20 additions and 2 deletions
|
@ -1,9 +1,11 @@
|
||||||
pub mod pandoc;
|
pub mod pandoc;
|
||||||
|
pub mod render;
|
||||||
|
|
||||||
use config::Config;
|
use config::Config;
|
||||||
|
|
||||||
|
|
||||||
pub fn build_input(config: Config, input: String) -> Result<String, String> {
|
pub fn build_input(config: Config, input: String) -> Result<String, String> {
|
||||||
let html = try!(pandoc::render(config, input));
|
let html = try!(pandoc::render(config.clone(), input));
|
||||||
return Ok(html);
|
let rendered = try!(render::render(config.clone(), html));
|
||||||
|
return Ok(rendered);
|
||||||
}
|
}
|
||||||
|
|
16
src/build/render.rs
Normal file
16
src/build/render.rs
Normal 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);
|
||||||
|
}
|
Reference in a new issue