Closed fukamachi closed 9 years ago
This is supposed to be supported already, but it is undocumented and not sure if is working. I'm trying to add some tests and ensure something like your example works. After that, if I'm successful, I'll add the documentation.
I've implemented loop variables access. You need to use forloop.last, forloop.first, etc.
I haven't documented it yet.
I've also implemented arrays and hash-table iteration and updated the docs: http://mmontone.github.io/djula/doc/build/html/tags.html#std:templatetag-for
Although Jinja2 has a special variable called
loop
(http://jinja.pocoo.org/docs/dev/templates/#for), Djula doesn't seem to have it.For example, this is an HTML template which shows
categories
with a comma between each element.As
loop.last
is always false, a comma is shown in the last of the line.It'd be great if this feature is also available in Djula. Or, any other ideas to do it?