-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Given JSON:
{
"images": [{
"src": "http://www.fpoimg.com/20x20"
},
{
"src": "http://www.fpoimg.com/30x30"
},
{
"src": "http://www.fpoimg.com/40x40"
}
],
"anEmptyArray": []
}
and template:
{{#images.length}}
<h3>The images: this should only be rendered once.</h3>
<ul>
{{#images}}
<li><img src="{{src}}"/></li>
{{/images}}
</ul>
{{/images.length}}
{{#anEmptyArray.length}}
<h3>The empty array: this should NOT be rendered.</h3>
{{/anEmptyArray.length}}
Some Mustache implementations (including the Demo here return:
<h3>The images: this should only be rendered once.</h3>
<ul>
<li><img src="http://www.fpoimg.com/20x20"/></li>
<li><img src="http://www.fpoimg.com/30x30"/></li>
<li><img src="http://www.fpoimg.com/40x40"/></li>
</ul>
The {{#images.length}} tag does not appear to be part of the Mustache spec. For that matter, neither does {{#images.0}} which could be used to refer to the first element of the array.
- This would seem to be a useful function.
- It is not part of the spec
- The spec appears to be dead (no commits in 4 years, no meaningful issue closure in 4 years)
- The ruby implementation appears to have had at least some activity within the last year, and the website within the last month.
It seems that we are in another "Markdown" scenario where the initial parent project is at least partially dead, whereas one or more child projects are still alive (including this one.) Which is unfortunate.
I will probably end up implementing these features, as they seem useful to me, and do not seem to violate the logic-less philosophy as demonstrated by other core features. But I don't have time at the moment, so this is a reminder to myself.
cluoma
Metadata
Metadata
Assignees
Labels
No labels