Open simonl2002 opened 11 years ago
Agreed, that sounds useful.
I did a quick test implementation, https://github.com/simonl2002/clostache/compare/master...lambda_render
What I did was if a section returned a lambda, we call that lambda with a rendering function as the argument. I did it this way because passing the render function directly to a section lambda is not really compliant with the spec and would break test cases.
Any word on this? Would be very nice...
Sorry, slipped off my radar :disappointed: Reviewed the pull request, pretty much ready to merge.
From the mustache manual:
After looking at the code appears that if a section is a function we apply it to the body
Which means there is no way for the lambda to render that text. Perhaps like the javascript mustache implementation a additional parameter should be passed into the lambda (https://github.com/janl/mustache.js#functions) for use in rendering the section contents if necessary.
An example: