This commit is contained in:
2025-04-05 11:03:58 +02:00
parent 4be9445702
commit fe7a676cac
11 changed files with 1145 additions and 61 deletions

View File

@@ -5,6 +5,7 @@ use std::path::Path;
use tera::{Context, Tera};
/// A builder for creating and rendering templates using the Tera template engine.
#[derive(Clone)]
pub struct TemplateBuilder {
template_path: String,
context: Context,
@@ -254,7 +255,7 @@ mod tests {
fn test_template_with_hashmap_vars() -> Result<(), Box<dyn std::error::Error>> {
// Create a temporary template file
let mut temp_file = NamedTempFile::new()?;
writeln!(temp_file, "{{ greeting }}, {{ name }}!")?;
writeln!(temp_file, "{{{{ greeting }}}}, {{{{ name }}}}!")?;
temp_file.flush()?;
// Create a HashMap of variables