@@ -135,9 +135,9 @@ pub fn render_template(template: &str, source_filename: &Path) -> Result<String,
135135 let mut tera = Tera :: default ( ) ;
136136
137137 // Allow templates to load variables files as Values.
138- tera. register_function ( "yamlload " , yamlloader) ;
139- tera. register_function ( "jsonload " , jsonloader) ;
140- tera. register_function ( "tomlload " , tomlloader) ;
138+ tera. register_function ( "yaml " , yamlloader) ;
139+ tera. register_function ( "json " , jsonloader) ;
140+ tera. register_function ( "toml " , tomlloader) ;
141141
142142 tera. add_raw_template ( & template_path, template)
143143 . map_err ( |e| errors:: FlokiError :: ProblemRenderingTemplate {
@@ -324,15 +324,17 @@ mod test {
324324
325325 #[ test]
326326 fn test_tera_yamlload ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
327- let template = r#"{% set values = yamlload(file="test_resources/values.yaml") %}shell: {{ values.foo }}"# ;
327+ let template =
328+ r#"{% set values = yaml(file="test_resources/values.yaml") %}shell: {{ values.foo }}"# ;
328329 let config = render_template ( template, Path :: new ( "floki" ) ) ?;
329330 assert_eq ! ( config, "shell: bar" ) ;
330331 Ok ( ( ) )
331332 }
332333
333334 #[ test]
334335 fn test_tera_jsonload ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
335- let template = r#"{% set values = jsonload(file="test_resources/values.json") %}shell: {{ values.foo }}"# ;
336+ let template =
337+ r#"{% set values = json(file="test_resources/values.json") %}shell: {{ values.foo }}"# ;
336338 let config = render_template ( template, Path :: new ( "floki" ) ) ?;
337339 assert_eq ! ( config, "shell: bar" ) ;
338340 Ok ( ( ) )
@@ -341,7 +343,7 @@ mod test {
341343 #[ test]
342344 fn test_tera_tomlload ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
343345 let template =
344- r#"{% set values = tomlload (file="Cargo.toml") %}floki: {{ values.package.name }}"# ;
346+ r#"{% set values = toml (file="Cargo.toml") %}floki: {{ values.package.name }}"# ;
345347 let config = render_template ( template, Path :: new ( "floki" ) ) ?;
346348 assert_eq ! ( config, "floki: floki" ) ;
347349 Ok ( ( ) )
0 commit comments