I'am using handlebars "com.github.jknack" % "handlebars" % "4.1.2"
for templating.
What I want is when compiling {{something.foo}}
and the result is HW
it replaces automatically the code HW
by its label Hello World !
. HW
can be the result of compiling {{something.bar}}
too.
Of course, I can use a helper to achieve this requirement, like {{hw something.foo}}
and {{hw something.bar}}
. But calling the helper every time is frustrating me.
I'm looking for something, in the context, for example, to do this, as:
Context.newBuilder(object)
.resolver(FieldValueResolver.INSTANCE, MethodValueResolver.INSTANCE)
.combine("HW", "Hello world !")
.build();
The code above is not working, I'm just trying.
Does someone have an idea?