-pub fn generate(_: &PathBuf, _: &PathBuf, _: &PathBuf, _: &Vec<Post>) -> Result<()> {
+const FILENAME: &str = "index.txt";
+
+pub fn generate(_: &PathBuf, template_directory: &PathBuf, target: &PathBuf, context: &TemplateContext) -> Result<()> {
+ match find(template_directory, FILENAME) {
+ Some(template) => {
+ let parsed_template = parse(&template)
+ .ok_or_else(|| Error::new(Other, "Unable to parse TXT template"))?;
+ let rendered_template = parsed_template.render(context)?;
+ let location = target.join(FILENAME);
+ write(location, rendered_template)?;
+ },
+ None => {}
+ }