Ticket #17719: 17719.diff

File 17719.diff, 1.4 KB (added by Tim Graham, 5 years ago)
  • docs/ref/templates/api.txt

    diff --git a/docs/ref/templates/api.txt b/docs/ref/templates/api.txt
    index 0a50e5e..3fad3e5 100644
    a b Builtin variables 
    274274Every context contains ``True``, ``False`` and ``None``. As you would expect,
    275275these variables resolve to the corresponding Python objects.
     277Limitations with string literals
     280Django's template language has no way to escape the characters used for its own
     281syntax. For example, the :ttag:`templatetag` tag is required if you need to
     282output character sequences like ``{%`` and ``%}``.
     284A similar issue exists if you want to include these sequences in template filter
     285or tag arguments. For example, when parsing a block tag, Django's template
     286parser looks for the first occurrence of ``%}`` after a ``{%``. This prevents
     287the use of ``"%}"`` as a string literal. For example, a ``TemplateSyntaxError``
     288will be raised for the following expressions::
     290  {% include "template.html" tvar="Some string literal with %} in it." %}
     292  {% with tvar="Some string literal with %} in it." %}{% endwith %}
     294This is also true for variable tag parsing::
     296  {{ some.variable|default:"}}" }}
     298You can store strings in template varaibles or use a custom template tag or
     299filter to workaround the limitation.
    277301Playing with Context objects
Back to Top