handlebars.java icon indicating copy to clipboard operation
handlebars.java copied to clipboard

Is the word "this" a reserved key name for Template compileInline?

Open rujiel opened this issue 4 years ago • 0 comments

For this code

        Map<String, Object> model = Map.of("name", "Ron", "that", "is cool");
        Template template = handlebars.compileInline("{{name}} {{that}}!");
        System.out.println(template.apply(model));

I get the output "Ron is cool!" But if I change the name of the second item from "that" to "this"..

Map<String, Object> model = Map.of("name", "Ron", "this", "is cool");
Template template = handlebars.compileInline("{{name}} {{this}}!");

The map object is printed out instead Ron {this&#x3D;is cool, name&#x3D;Ron}!

is "this" is the intended behavior? Thanks

Edit: and if it is, is there a way to escape names like "this"? Triple braces didn't seem to work

rujiel avatar Nov 03 '22 23:11 rujiel