projects
/
konrad/twig.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
fbd6f85
)
added a note about accessing variable attributes that contains operators (closes...
author
Fabien Potencier
<fabien.potencier@gmail.com>
Wed, 18 Jul 2012 07:53:29 +0000 (09:53 +0200)
committer
Fabien Potencier
<fabien.potencier@gmail.com>
Wed, 18 Jul 2012 07:53:29 +0000 (09:53 +0200)
doc/templates.rst
patch
|
blob
|
history
diff --git
a/doc/templates.rst
b/doc/templates.rst
index
cf6d19d
..
c37e5c6
100644
(file)
--- a/
doc/templates.rst
+++ b/
doc/templates.rst
@@
-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