samskivert / jmustache

A Java implementation of the Mustache templating language.
Other
839 stars 128 forks source link

Parametrized lambda support #133

Open jvmlet opened 2 years ago

jvmlet commented 2 years ago

Is parametrized lambda supported ? Looking for something like below :

{{myLambda [param1='val1',param2=2]}}  inner  {{\myLambda}} 
agentgt commented 2 years ago

Handlebars allows that. If you want that look into Handlebars.java.

jvmlet commented 2 years ago

Thanks @agentgt, I'm aware about handlebars

agentgt commented 2 years ago

Yes but your request seems kind of out of scope for a library that mostly follows the mustache spec.

Adding parameters basically makes it not logic-less and there is a library with a spec that has lambda with parameters aka handlebars.

agentgt commented 10 months ago

@jvmlet Did you ever solve your problem?

I forgot to mention you could also use Mustache Lambdas and parse the section body or do a builder approach where you return a lambda that returns an object that has more lambdas.

If you are still interested I can show the builder approach with some code.