On Fri, Dec 27, 2013 at 11:58 AM, Ryan Kaldari rkaldari@wikimedia.orgwrote:
What sort of control structures would you want supported? Keep in mind that ideally we want something that is simple enough that it could be loaded as a client-side library on mobile, and also be reasonably sure that it won't introduce any security issues.
As in any type of control structure. Mustache is explicitly a template language without control structures. You can technically implement if/else statements and for loops using Mustache's sections, but you can't have expressions in your if statements. Template languages like Twig are more like an actual programming language.
Mustache also does not have template inheritance, which would be really useful in an extensible templating system.
On a side note, there are a lot of things that both Mustache and Twig do that are lot easier and more sensible in the latter. Filters, for example. In Mustache using filters involves using a section and looks exactly the same as an if statement. Using multiple filters at once involves multiple sections. In Twig there's a specific syntax that makes filtering a lot simpler. Also Twig has PhpStorm support, which is a plus.
*-- * *Tyler Romeo* Stevens Institute of Technology, Class of 2016 Major in Computer Science