On Tue, Mar 12, 2013 at 07:04:54PM +0100, Moritz Heidkamp wrote: > Hi Matt, > > Matt Gushee <[email protected]> writes: > > 3) {% if not loop.last %} also raises a parser error. This was a fairly > > important feature for me, because I have a couple of templates that > > generate JSON from arbitrary-length lists of objects, and there needs to be > > a comma *between* the objects in JSON. So I was doing this: > > This doesn't seem like a very good idea to me. You might generate > invalid JSON if the values you pass into the template don't happen to > have textual representations which also happen to be valid JSON values > (if I understand the way Jinja works correctly here). I'd suggest using > a proper JSON emitter like the one contained in medea > (http://wiki.call-cc.org/eggref/4/medea) instead.
Not to sound like a broken record, but I'd add that this applies 100% to HTML/XML as well. I would suggest using SXML or something similar over a string-based templating language. This allows you to prevent injection bugs as well as accidental mismatching of opening/closing tags. Cheers, Peter -- http://www.more-magic.net _______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
