-
Notifications
You must be signed in to change notification settings - Fork 423
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
Helper does not work in array? #173
Comments
Can you show me your data too? |
Here it is, originally, it's parsed from JSON.
|
Ahh. I think i know what is happening. Try changing your nl2br helper: function($text, $mustache) {
return nl2br($mustache->render($text));
} |
@bobthecow Great! It work, wonder why? |
It works because of how the Mustache spec treats "lambda sections", which is what helpers actually are. In your case, it's this part of the template: {{# nl2br }}{{ english }}{{/ nl2br }} Per the spec, the raw template contents is sent to the helper. So it's calling the helper with the contents of that section: {{ english }} Note that this isn't rendered yet. So you were calling Then you'd call |
How to solve?
The text was updated successfully, but these errors were encountered: