small performance improvements
--HG--
branch : trunk
diff --git a/docs/api.rst b/docs/api.rst
index 9562263..3ad17ac 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -123,13 +123,13 @@
The Context
-----------
-.. autoclass:: jinja2.runtime.TemplateContext
+.. autoclass:: jinja2.runtime.Context
:members: super, get, get_exported, get_all
.. attribute:: parent
A dict of read only, global variables the template looks up. These
- can either come from another :class:`TemplateContext`, from the
+ can either come from another :class:`Context`, from the
:attr:`Environment.globals` or :attr:`Template.globals`. It must not
be altered.
@@ -279,7 +279,7 @@
return result
Context filters work the same just that the first argument is the current
-active :class:`TemplateContext` rather then the environment.
+active :class:`Context` rather then the environment.
.. _writing-tests:
diff --git a/docs/templates.rst b/docs/templates.rst
index 85171d6..7c0ed5c 100644
--- a/docs/templates.rst
+++ b/docs/templates.rst
@@ -797,6 +797,19 @@
For example, range(4) returns [0, 1, 2, 3]. The end point is omitted!
These are exactly the valid indices for a list of 4 elements.
+ This is useful to repeat a template block multiple times for example
+ to fill a list. Imagine you have 7 users in the list but you want to
+ render three empty items to enforce a height with CSS::
+
+ <ul>
+ {% for user in users %}
+ <li>{{ user.username }}</li>
+ {% endfor %}
+ {% for number in range(10 - users|count) %}
+ <li class="empty"><span>...</span></li>
+ {% endfor %}
+ </ul>
+
.. function:: lipsum(n=5, html=True, min=20, max=100)
Generates some lorem ipsum for the template. Per default five paragraphs