Ticket #4000: filterarguments.diff

File filterarguments.diff, 1.5 KB (added by Simon G. <dev@…>, 8 years ago)
  • tests/regressiontests/templates/tests.py

     
    219219            # value will be converted to a bytestring.
    220220            'filter-syntax18': (r'{{ var }}', {'var': UnicodeInStrClass()}, '\xc5\xa0\xc4\x90\xc4\x86\xc5\xbd\xc4\x87\xc5\xbe\xc5\xa1\xc4\x91'),
    221221
     222            # Numbers as filter arguments should work
     223            'filter-syntax19': ('{{ var|truncatewords:1 }}', {"var": "hello world"}, "hello ..."),
     224
    222225            ### COMMENT SYNTAX ########################################################
    223226            'comment-syntax01': ("{# this is hidden #}hello", {}, "hello"),
    224227            'comment-syntax02': ("{# this is hidden #}hello{# foo #}", {}, "hello"),
  • docs/templates.txt

     
    9292then converting line breaks to ``<p>`` tags.
    9393
    9494Some filters take arguments. A filter argument looks like this:
    95 ``{{ bio|truncatewords:"30" }}``. This will display the first 30 words of the
    96 ``bio`` variable. Filter arguments always are in double quotes.
     95``{{ bio|truncatewords:30 }}``. This will display the first 30 words of the
     96``bio`` variable.
    9797
    9898The `Built-in filter reference`_ below describes all the built-in filters.
    9999
Back to Top