3 ms·
Mustache has an equivalent to {.or} {{^something}} {{/something}} The draw of mustache is that it does things implicitly. I don't have to worry about .section
by binspace 16y ago
Mustache has an equivalent to {.or}
{{^something}}
{{/something}}
The draw of mustache is that it does things implicitly. I don't have to worry about .section, .repeated, .or, |html, for example. Mustache does it for me.
That being said, one thing that mustache does need to address is the difference between conditionals and repeated operations as needed (handled by .section and .repeated in JSON Template).
AFAIK, the songs template would require a boolean to be passed in of the existence of songs in mustache, since mustache would implicitly assume that {{#songs}} was a loop and create multiple tables.
http://json-template.googlecode.com/svn/trunk/doc/Introducing-JSON-Template.html http://json-template.googlecode.com/svn/trunk/doc/Introducin...
- janl 16y agoIf you read the linked article, you'd see that I am calling for an {.or}-like construct to avoid having to use inverted sections for a fake else-case.
- binspace 16y agoGot it. I guess the distinction is not that big of a deal for me, though it would be nice to have the inline {.or}-like construct (it saves one statement).
- chubot 16y agoYou can set the default formatter to "html" if you want (or any other formatter). It probably could be better documented. You seem to be on the fence about if you want an explicit "repeated" or not. I haven't thought about it too much but it seems cleaner to be explicit. I don't want to confuse an object {} and a singleton array [{}].