use std::collections::HashMap;
pub fn process(
template: &str,
params: &HashMap<String, String>,
) -> Result<String, String> {
let mut tera = tera::Tera::default();
tera.autoescape_on(vec![]);
tera.add_raw_template("template", template)
.map_err(|e| format!("Tera template error: {}", e))?;
let mut context = tera::Context::new();
for (key, value) in params {
context.insert(key, value);
}
tera.render("template", &context)
.map_err(|e| format!("Tera render error: {}", e))
}