X-Git-Url: https://git.r.bdr.sh/rbdr/blog/blobdiff_plain/60307a9a3a39dccf652c9d9b4348e44db1e67627..6352ebb0eb4cb83240c6d4998e0ef1375b041191:/src/archiver/gopher.rs?ds=inline diff --git a/src/archiver/gopher.rs b/src/archiver/gopher.rs new file mode 100644 index 0000000..820e4d1 --- /dev/null +++ b/src/archiver/gopher.rs @@ -0,0 +1,19 @@ +use std::fs::write; +use std::io::Result; +use std::path::PathBuf; +use crate::template::{find, parse, TemplateContext}; + +const FILENAME: &str = "index.gph"; + +pub fn archive(_: &PathBuf, template_directory: &PathBuf, target: &PathBuf, context: &TemplateContext) -> Result<()> { + match find(template_directory, FILENAME) { + Some(template) => { + let parsed_template = parse(&template); + let rendered_template = parsed_template.render(context); + let location = target.join(FILENAME); + write(location, rendered_template)?; + }, + None => {} + } + Ok(()) +}