@@ -39,6 +39,10 @@ pub struct Template {
39
39
pub compare_to : Option < String > ,
40
40
pub pre_hook : Option < String > ,
41
41
pub post_hook : Option < String > ,
42
+ pub expr_prefix : Option < String > ,
43
+ pub expr_postfix : Option < String > ,
44
+ pub block_prefix : Option < String > ,
45
+ pub block_postfix : Option < String > ,
42
46
}
43
47
44
48
#[ allow( clippy:: manual_strip) ]
@@ -78,11 +82,6 @@ impl Template {
78
82
) -> Result < ( ) , Report > {
79
83
info ! ( "Loaded <b><cyan>{}</> templates." , & templates. len( ) ) ;
80
84
81
- let syntax = Syntax :: builder ( ) . expr ( "{{" , "}}" ) . block ( "<*" , "*>" ) . build ( ) ;
82
- let mut engine = Engine :: with_syntax ( syntax) ;
83
-
84
- add_engine_filters ( & mut engine) ;
85
-
86
85
let image = match & source {
87
86
Source :: Image { path } => Some ( path) ,
88
87
#[ cfg( feature = "web-image" ) ]
@@ -99,6 +98,19 @@ impl Template {
99
98
) ?;
100
99
101
100
for ( i, ( name, template) ) in templates. iter ( ) . enumerate ( ) {
101
+ let expr_prefix = template. expr_prefix . as_deref ( ) . unwrap_or ( "{{" ) ;
102
+ let expr_postfix = template. expr_postfix . as_deref ( ) . unwrap_or ( "}}" ) ;
103
+ let block_prefix = template. block_prefix . as_deref ( ) . unwrap_or ( "<*" ) ;
104
+ let block_postfix = template. block_postfix . as_deref ( ) . unwrap_or ( "*>" ) ;
105
+
106
+ let syntax = Syntax :: builder ( )
107
+ . expr ( expr_prefix, expr_postfix)
108
+ . block ( block_prefix, block_postfix)
109
+ . build ( ) ;
110
+ let mut engine = Engine :: with_syntax ( syntax) ;
111
+
112
+ add_engine_filters ( & mut engine) ;
113
+
102
114
let ( input_path_absolute, output_path_absolute) =
103
115
get_absolute_paths ( & config_path, template) ?;
104
116
0 commit comments