X-Git-Url: https://git.r.bdr.sh/rbdr/blog/blobdiff_plain/2998247083406f914b3647cedd19abf5507bf2c6..c44af4d376a3a2edfa5aceae6b81f3fdcf550146:/src/generator/mod.rs 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