|
|
|
@ -97,29 +97,6 @@ by default:
|
|
|
|
|
|
|
|
|
|
{% from '_helpers.html' import my_macro with context %} |
|
|
|
|
|
|
|
|
|
Standard Filters |
|
|
|
|
---------------- |
|
|
|
|
|
|
|
|
|
These filters are available in Jinja2 additionally to the filters provided |
|
|
|
|
by Jinja2 itself: |
|
|
|
|
|
|
|
|
|
.. function:: tojson |
|
|
|
|
:noindex: |
|
|
|
|
|
|
|
|
|
This function converts the given object into JSON representation. This |
|
|
|
|
is for example very helpful if you try to generate JavaScript on the |
|
|
|
|
fly. |
|
|
|
|
|
|
|
|
|
Note that inside ``script`` tags no escaping must take place, so make |
|
|
|
|
sure to disable escaping with ``|safe`` before Flask 0.10 if you intend |
|
|
|
|
to use it inside ``script`` tags: |
|
|
|
|
|
|
|
|
|
.. sourcecode:: html+jinja |
|
|
|
|
|
|
|
|
|
<script type=text/javascript> |
|
|
|
|
doSomethingWith({{ user.username|tojson|safe }}); |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
Controlling Autoescaping |
|
|
|
|
------------------------ |
|
|
|
|
|
|
|
|
|