From 78c5bacd4b4e43d683552fba787775abfe83b75c Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 15 Aug 2017 22:00:56 +0100 Subject: [PATCH] Add structure for post-processing renderers --- src/build/mod.rs | 6 ++++-- src/build/render.rs | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 src/build/render.rs diff --git a/src/build/mod.rs b/src/build/mod.rs index a21c808..341368e 100644 --- a/src/build/mod.rs +++ b/src/build/mod.rs @@ -1,9 +1,11 @@ pub mod pandoc; +pub mod render; use config::Config; pub fn build_input(config: Config, input: String) -> Result { - 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); } diff --git a/src/build/render.rs b/src/build/render.rs new file mode 100644 index 0000000..e62854b --- /dev/null +++ b/src/build/render.rs @@ -0,0 +1,16 @@ +use config::Config; + + +fn stub(config: Config, input: String) -> Result { + return Ok(input); +} + +pub fn render(config: Config, input: String) -> Result { + let mut rendered_input = input; + for renderer in vec![ + stub + ] { + rendered_input = try!(renderer(config.clone(), rendered_input)); + } + return Ok(rendered_input); +}