summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2013-05-19 03:07:28 -0700
committerArmin Ronacher <armin.ronacher@active-4.com>2013-05-19 03:07:28 -0700
commit604752bb83da3290095e8456e0f03fc662e7c24b (patch)
treefa7e430b747edc5c7d0b7207473b1a08f262a8f8
parent7e2b823af63a3206c441fb460580527b3347f4de (diff)
parent8e01f54765b66c2f5e8bfa316157e5669e940229 (diff)
downloadjinja2-604752bb83da3290095e8456e0f03fc662e7c24b.tar.gz
Merge pull request #165 from AquarHEAD/master
Update the Docstring of do_truncate in jinja2/filters.py
-rw-r--r--jinja2/filters.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/jinja2/filters.py b/jinja2/filters.py
index 9da1195..c1dee42 100644
--- a/jinja2/filters.py
+++ b/jinja2/filters.py
@@ -445,16 +445,17 @@ def do_truncate(s, length=255, killwords=False, end='...'):
"""Return a truncated copy of the string. The length is specified
with the first parameter which defaults to ``255``. If the second
parameter is ``true`` the filter will cut the text at length. Otherwise
- it will try to save the last word. If the text was in fact
+ it will discard the last word. If the text was in fact
truncated it will append an ellipsis sign (``"..."``). If you want a
different ellipsis sign than ``"..."`` you can specify it using the
third parameter.
- .. sourcecode jinja::
+ .. sourcecode:: jinja
- {{ mytext|truncate(300, false, '&raquo;') }}
- truncate mytext to 300 chars, don't split up words, use a
- right pointing double arrow as ellipsis sign.
+ {{ "foo bar"|truncate(5) }}
+ -> "foo ..."
+ {{ "foo bar"|truncate(5, True) }}
+ -> "foo b..."
"""
if len(s) <= length:
return s