]> git.r.bdr.sh - rbdr/blog/blob - src/generator/mod.rs
c4bf1e116f2bcdf9f2a2d8da0e752ebaa38eac10
[rbdr/blog] / src / generator / mod.rs
1 mod static_files;
2 mod html;
3 mod rss;
4 mod txt;
5
6 use std::io::Result;
7 use std::path::PathBuf;
8 use crate::post::Post;
9
10 pub fn generate(static_directory: &PathBuf, template_directory: &PathBuf, output_directory: &PathBuf, posts: &Vec<Post>) -> Result<()> {
11 let generators = available_generators();
12 for generator in generators {
13 generator(static_directory, template_directory, output_directory, posts)?;
14 }
15 Ok(())
16 }
17
18
19 fn available_generators() -> Vec<fn(&PathBuf, &PathBuf, &PathBuf, &Vec<Post>) -> Result<()>> {
20 vec![
21 static_files::generate,
22 html::generate,
23 rss::generate,
24 txt::generate
25 ]
26 }