Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for lambdas? #1

Open
dagoss opened this issue Oct 4, 2016 · 1 comment
Open

Support for lambdas? #1

dagoss opened this issue Oct 4, 2016 · 1 comment

Comments

@dagoss
Copy link

dagoss commented Oct 4, 2016

Based on the Mustache(5), mustache is supposed to have support for lambdas. This is also supposed by JMustache.

Lambdas

When the value is a callable object, such as a function or lambda, the object will be invoked and passed the block of text. The text passed is the literal block, unrendered. {{tags}} will not have been expanded - the lambda should do that on its own. In this way you can implement filters or caching.

Template:

{{#wrapped}}
{{name}} is awesome.
{{/wrapped}}

Hash:

{
   "name": "Willy",
   "wrapped": function() {
        return function(text, render) {
            return "<b>" + render(text) + "</b>"
        }
    }
}

Output:

<b>Willy is awesome.</b>

It seems that mustache-ant does not support this. Is this something that can/should be supported?

@patjlm
Copy link
Owner

patjlm commented Oct 5, 2016

I am not sure how that would look like within ant. Something like a filter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants