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

is there a way not use escape in hbs, then keep undefined var?

Open mumubin opened this issue 3 years ago • 0 comments

@SneakyThrows
@Test
void testRenderUndefined() {
    Handlebars handlebars = new Handlebars();
    com.github.jknack.handlebars.Template template = handlebars.compileInline("Hi {{name}}, {{raw}}!");
    Map<String, String> parameterMap = new HashMap<>();
    parameterMap.put("name", "moto");
    String templateString = template.apply(parameterMap);
    assertEquals(templateString, "Hi moto, {{raw}}!");
}

I know using the following way can do this, but I don't want to change the template, because it is provided by other team

mumubin avatar Mar 24 '22 08:03 mumubin