

Ask HN: Can anyone rec a simple templating language implemented in py and js? - kortina

The goal is to be able to present json data as html/ui, and do the rendering both on the server or client side. Most of the time the server app will generate the html when the page first loads, but when a list gets updated via user interaction with javascript, I don't want to have custom javascript duplicating the rendering that happens in my python templates. I have been looking at JSON-template (http://bit.ly/aO27UM) but would love to know if anyone has any recs. Also looked at Google Closure templates, but they are implemented in server side java, not python. Anyone have any good solutions they recommend?
======
jlindley
Mustache: <http://mustache.github.com/>

For Python: <http://github.com/defunkt/pystache>

For Javascript: <http://github.com/janl/mustache.js>

Syntax docs: <http://mustache.github.com/mustache.5.html>

~~~
kortina
Playing with mustache and liking it so far. Thank you!

------
DanielStraight
This might be worth looking into:

<http://beebole.com/pure/>

I haven't used it in production, but I've found it interesting nonetheless.

~~~
tchvil
The big difference PURE has with other templating engine is the total
separation between the HTML representation and the JS logic.

As a result the JS code is live at rendering time and not stringified,
allowing to pass functions as parameters and closures.

As the authors of the lib, we use it in production and are very satisfied of
the speed. Some prominent newspapers here in Belgium are using it as well for
some parts of their sites.

Thanks for the link.

