added a note about accessing variable attributes that contains operators (closes #775)

This commit is contained in:
Fabien Potencier
2012-07-18 09:53:29 +02:00
parent fbd6f85b92
commit d70860f5f5
+9
View File
@@ -74,6 +74,15 @@ properties of a PHP object, or items of a PHP array), or the so-called
{{ foo.bar }}
{{ foo['bar'] }}
When the attribute contains special characters (like ``-`` that would be
interpreted as the minus operator), use the ``attribute`` function instead to
access the variable attribute:
.. code-block:: jinja
{# equivalent to the non-working foo.data-foo #}
{{ attribute(foo, 'data-foo') }}
.. note::
It's important to know that the curly braces are *not* part of the