[1.8.x] Corrected some inconsistent headings in docs/ref/templates/builtins.txt.

Backport of 7080cef7bf from master
This commit is contained in:
Tim Graham 2015-08-08 08:09:27 -04:00
parent cda66497aa
commit 43a05a93e9
1 changed files with 19 additions and 22 deletions

View File

@ -389,7 +389,7 @@ clauses, as well as an ``{% else %}`` clause that will be displayed if all
previous conditions fail. These clauses are optional. previous conditions fail. These clauses are optional.
Boolean operators Boolean operators
^^^^^^^^^^^^^^^^^ """""""""""""""""
:ttag:`if` tags may use ``and``, ``or`` or ``not`` to test a number of :ttag:`if` tags may use ``and``, ``or`` or ``not`` to test a number of
variables or to negate a given variable:: variables or to negate a given variable::
@ -431,9 +431,8 @@ them to indicate precedence, you should use nested :ttag:`if` tags.
:ttag:`if` tags may also use the operators ``==``, ``!=``, ``<``, ``>``, :ttag:`if` tags may also use the operators ``==``, ``!=``, ``<``, ``>``,
``<=``, ``>=`` and ``in`` which work as follows: ``<=``, ``>=`` and ``in`` which work as follows:
``==`` operator ``==`` operator
^^^^^^^^^^^^^^^ ~~~~~~~~~~~~~~~
Equality. Example:: Equality. Example::
@ -442,7 +441,7 @@ Equality. Example::
{% endif %} {% endif %}
``!=`` operator ``!=`` operator
^^^^^^^^^^^^^^^ ~~~~~~~~~~~~~~~
Inequality. Example:: Inequality. Example::
@ -452,7 +451,7 @@ Inequality. Example::
{% endif %} {% endif %}
``<`` operator ``<`` operator
^^^^^^^^^^^^^^ ~~~~~~~~~~~~~~
Less than. Example:: Less than. Example::
@ -461,7 +460,7 @@ Less than. Example::
{% endif %} {% endif %}
``>`` operator ``>`` operator
^^^^^^^^^^^^^^ ~~~~~~~~~~~~~~
Greater than. Example:: Greater than. Example::
@ -470,7 +469,7 @@ Greater than. Example::
{% endif %} {% endif %}
``<=`` operator ``<=`` operator
^^^^^^^^^^^^^^^ ~~~~~~~~~~~~~~~
Less than or equal to. Example:: Less than or equal to. Example::
@ -479,7 +478,7 @@ Less than or equal to. Example::
{% endif %} {% endif %}
``>=`` operator ``>=`` operator
^^^^^^^^^^^^^^^ ~~~~~~~~~~~~~~~
Greater than or equal to. Example:: Greater than or equal to. Example::
@ -488,7 +487,7 @@ Greater than or equal to. Example::
{% endif %} {% endif %}
``in`` operator ``in`` operator
^^^^^^^^^^^^^^^ ~~~~~~~~~~~~~~~
Contained within. This operator is supported by many Python containers to test Contained within. This operator is supported by many Python containers to test
whether the given value is in the container. The following are some examples whether the given value is in the container. The following are some examples
@ -509,11 +508,10 @@ of how ``x in y`` will be interpreted::
{% endif %} {% endif %}
``not in`` operator ``not in`` operator
^^^^^^^^^^^^^^^^^^^ ~~~~~~~~~~~~~~~~~~~
Not contained within. This is the negation of the ``in`` operator. Not contained within. This is the negation of the ``in`` operator.
The comparison operators cannot be 'chained' like in Python or in mathematical The comparison operators cannot be 'chained' like in Python or in mathematical
notation. For example, instead of using:: notation. For example, instead of using::
@ -523,9 +521,8 @@ you should use::
{% if a > b and b > c %} {% if a > b and b > c %}
Filters Filters
^^^^^^^ """""""
You can also use filters in the :ttag:`if` expression. For example:: You can also use filters in the :ttag:`if` expression. For example::
@ -534,7 +531,7 @@ You can also use filters in the :ttag:`if` expression. For example::
{% endif %} {% endif %}
Complex expressions Complex expressions
^^^^^^^^^^^^^^^^^^^ """""""""""""""""""
All of the above can be combined to form complex expressions. For such All of the above can be combined to form complex expressions. For such
expressions, it can be important to know how the operators are grouped when the expressions, it can be important to know how the operators are grouped when the
@ -564,7 +561,6 @@ If you need different precedence, you will need to use nested :ttag:`if` tags.
Sometimes that is better for clarity anyway, for the sake of those who do not Sometimes that is better for clarity anyway, for the sake of those who do not
know the precedence rules. know the precedence rules.
.. templatetag:: ifchanged .. templatetag:: ifchanged
ifchanged ifchanged
@ -808,7 +804,6 @@ This would display as "It is the 4th of September".
It is {% now "SHORT_DATETIME_FORMAT" %} It is {% now "SHORT_DATETIME_FORMAT" %}
You can also use the syntax ``{% now "Y" as current_year %}`` to store the You can also use the syntax ``{% now "Y" as current_year %}`` to store the
output (as a string) inside a variable. This is useful if you want to use output (as a string) inside a variable. This is useful if you want to use
``{% now %}`` inside a template tag like :ttag:`blocktrans` for example:: ``{% now %}`` inside a template tag like :ttag:`blocktrans` for example::
@ -827,7 +822,9 @@ regroup
Regroups a list of alike objects by a common attribute. Regroups a list of alike objects by a common attribute.
This complex tag is best illustrated by way of an example: say that "places" is a list of cities represented by dictionaries containing ``"name"``, ``"population"``, and ``"country"`` keys: This complex tag is best illustrated by way of an example: say that "places" is
a list of cities represented by dictionaries containing ``"name"``,
``"population"``, and ``"country"`` keys:
.. code-block:: python .. code-block:: python
@ -839,7 +836,8 @@ This complex tag is best illustrated by way of an example: say that "places" is
{'name': 'Tokyo', 'population': '33,000,000', 'country': 'Japan'}, {'name': 'Tokyo', 'population': '33,000,000', 'country': 'Japan'},
] ]
...and you'd like to display a hierarchical list that is ordered by country, like this: ...and you'd like to display a hierarchical list that is ordered by country,
like this:
* India * India
@ -855,7 +853,6 @@ This complex tag is best illustrated by way of an example: say that "places" is
* Tokyo: 33,000,000 * Tokyo: 33,000,000
You can use the ``{% regroup %}`` tag to group the list of cities by country. You can use the ``{% regroup %}`` tag to group the list of cities by country.
The following snippet of template code would accomplish this:: The following snippet of template code would accomplish this::
@ -935,7 +932,7 @@ Another solution is to sort the data in the template using the
{% regroup cities|dictsort:"country" by country as country_list %} {% regroup cities|dictsort:"country" by country as country_list %}
Grouping on other properties Grouping on other properties
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ """"""""""""""""""""""""""""
Any valid template lookup is a legal grouping attribute for the regroup Any valid template lookup is a legal grouping attribute for the regroup
tag, including methods, attributes, dictionary keys and list items. For tag, including methods, attributes, dictionary keys and list items. For
@ -2422,8 +2419,8 @@ Django's built-in :tfilter:`escape` filter. The default value for
urlizetrunc urlizetrunc
^^^^^^^^^^^ ^^^^^^^^^^^
Converts URLs and email addresses into clickable links just like urlize_, but truncates URLs Converts URLs and email addresses into clickable links just like urlize_, but
longer than the given character limit. truncates URLs longer than the given character limit.
**Argument:** Number of characters that link text should be truncated to, **Argument:** Number of characters that link text should be truncated to,
including the ellipsis that's added if truncation is necessary. including the ellipsis that's added if truncation is necessary.