X-Git-Url: https://git.r.bdr.sh/rbdr/blog/blobdiff_plain/2998247083406f914b3647cedd19abf5507bf2c6..36a4680d18de012e2e5c732f9db161dafa884344:/src/generator/mod.rs?ds=sidebyside diff --git a/src/generator/mod.rs b/src/generator/mod.rs index c4bf1e1..e967e41 100644 --- a/src/generator/mod.rs +++ b/src/generator/mod.rs @@ -6,19 +6,22 @@ mod txt; use std::io::Result; use std::path::PathBuf; use crate::post::Post; +use crate::template::TemplateContext; pub fn generate(static_directory: &PathBuf, template_directory: &PathBuf, output_directory: &PathBuf, posts: &Vec) -> Result<()> { let generators = available_generators(); + let context = Post::to_template_context(&posts); for generator in generators { - generator(static_directory, template_directory, output_directory, posts)?; + generator(static_directory, template_directory, output_directory, &context)?; } Ok(()) } -fn available_generators() -> Vec) -> Result<()>> { +fn available_generators() -> Vec Result<()>> { vec![ static_files::generate, + // These three are actually the same. Can generalize, don't know how in rust yet. html::generate, rss::generate, txt::generate