As an alternative, it looks good, so thanks for bringing it up.
I don't know about the python version, but I had a look at the Javascript code for json-template. At first look it seems pretty "hacky". The main obvious flaws I saw were:
- it's polluting the global namespace a lot. Introducing a lot of functions and variables. - it's roughly 800 lines, while mustache.js is just over 300. I realize json template has more features. - A lot of the javascript could do with some optimization. Especially some of the loops.
But maybe that's something you simply want help with?
If you have some speedups I'm open to it, although I think it is pretty fast as it doesn't parse the template on every expansion.
{{^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/Introducin...
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 [{}].
It solves ALL of these problems. It has {.or}, the dot notation, and searches up the stack of contexts for variables.
I haven't been working on it for awhile, mostly because it does the job, but the codebase is small and easily hackable.
EDIT: It also compiles the templates and lets you change the delimiters! And has support for several other languages.