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

@@ -31,6 +31,7 @@ impl ReplacementOperation {
/// Text replacer that can perform multiple replacement operations
/// in a single pass over the input text.
#[derive(Clone)]
pub struct TextReplacer {
operations: Vec<ReplacementOperation>,
}
@@ -82,7 +83,7 @@ impl TextReplacer {
}
/// Builder for the TextReplacer.
#[derive(Default)]
#[derive(Default, Clone)]
pub struct TextReplacerBuilder {
operations: Vec<ReplacementOperation>,
pattern: Option<String>,

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