Closed jonhartmann closed 10 years ago
20abde5b1abcbf50ff8f9cc607ac33fed3f45339 should do what you want.
It's a little pesky that you still have to use a block for the lamda, but as far as I can tell from the docs, lambdas were only ever meant to occur for blocks (not totally crazy since the lambda is supposed to be able to execute the template fragment inside the block). This is clearly a somewhat special use case, so I'm not inclined to also add support for bodyless lambdas (i.e. lambdas appearing as plain old lookups like {{mylambda}}).
I was trying to replicate the technique used in this post:
http://stackoverflow.com/questions/9162977/is-it-possible-to-switch-template-partial-based-on-hash-value-in-mustache
In order to solve the same problem with JMustache (switching templates based on an object properties), but the lack of a context when evaluating the Lambda is killing it. I've tried to hack the code to get a version with Context, but its not going well (I'm not super proficient at Java). Any chance we can get a better Lambda implementation so I can pull it off?