summaryrefslogtreecommitdiff
path: root/jinja2
diff options
context:
space:
mode:
authorsevas <f.degroef@gmail.com>2011-05-01 23:28:25 +0200
committersevas <f.degroef@gmail.com>2011-05-01 23:28:25 +0200
commit218cb643136134da17526e01a42c30a4c71f27ba (patch)
tree0df0abb735d8afd24319703a538c4135947700fd /jinja2
parente68d4c6ec147347e574543e972fa0c2ede771700 (diff)
downloadjinja2-218cb643136134da17526e01a42c30a4c71f27ba.tar.gz
wordwrap filter should use the newline_sequence defined in current Environment object
Diffstat (limited to 'jinja2')
-rw-r--r--jinja2/filters.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/jinja2/filters.py b/jinja2/filters.py
index c5782e2..5b394de 100644
--- a/jinja2/filters.py
+++ b/jinja2/filters.py
@@ -443,8 +443,8 @@ def do_truncate(s, length=255, killwords=False, end='...'):
result.append(end)
return u' '.join(result)
-
-def do_wordwrap(s, width=79, break_long_words=True):
+@environmentfilter
+def do_wordwrap(environment, s, width=79, break_long_words=True):
"""
Return a copy of the string passed to the filter wrapped after
``79`` characters. You can override this default using the first
@@ -452,7 +452,7 @@ def do_wordwrap(s, width=79, break_long_words=True):
split words apart if they are longer than `width`.
"""
import textwrap
- return u'\n'.join(textwrap.wrap(s, width=width, expand_tabs=False,
+ return environment.newline_sequence.join(textwrap.wrap(s, width=width, expand_tabs=False,
replace_whitespace=False,
break_long_words=break_long_words))