summaryrefslogtreecommitdiff
path: root/docs/switching.rst
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2013-05-19 03:29:35 -0700
committerArmin Ronacher <armin.ronacher@active-4.com>2013-05-19 03:29:35 -0700
commitc5005a7edfc578265ccef4026d4c30a0124d1361 (patch)
treecc79f7c6e03aaf014d830ef2a519dc211596d761 /docs/switching.rst
parent55ea1df4c54562a9c7dec54d047868118d9eae0b (diff)
parent7336b7af6c20a811930d49e97ef1bc447e062efa (diff)
downloadjinja2-c5005a7edfc578265ccef4026d4c30a0124d1361.tar.gz
Merge pull request #104 from njl/fix-issue-77
Fix issue #77
Diffstat (limited to 'docs/switching.rst')
-rw-r--r--docs/switching.rst22
1 files changed, 19 insertions, 3 deletions
diff --git a/docs/switching.rst b/docs/switching.rst
index 6bb8b07..41bb5b0 100644
--- a/docs/switching.rst
+++ b/docs/switching.rst
@@ -177,9 +177,25 @@ operator. Here are some examples::
Loops
~~~~~
-For loops work very similar to Django, the only incompatibility is that in
-Jinja2 the special variable for the loop context is called `loop` and not
-`forloop` like in Django.
+For loops work very similar to Django. Notably, in Jinja2 the special variable for
+the loop context is called `loop` and not `forloop` like in Django.
+
+In addition, the Django `empty` argument is called `else` in Jinja2. For example, the
+Django template::
+
+ {% for item in items %}
+ {{item}}
+ {% empty %}
+ No items!
+ {% endfor %}
+
+would be handled in Flask as::
+
+ {% for item in items %}
+ {{item}}
+ {% else %}
+ No items!
+ {% endfor %}
Cycle
~~~~~