Skip to content
Myr

Merge pull request #30 from sevas/wordwrap-newline

Before adoption: this commit came in with the history the project adopted, so no landing records it.

wordwrap filter should use the newline_sequence defined in current Environment

authored by Armin Ronacher · committed by Armin Ronacher · parents fbfc9d2, 218cb64 · Browse files · 1 file+3 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−3 removed

  • other:+3 added−3 removed

1 file+3 added−3 removed

modified:jinja2/filters.py+3 added-3 removed
441 unmodified lines
442 result.append(word)443 result.append(end)444 return u' '.join(result)445446447def do_wordwrap(s, width=79, break_long_words=True):446@environmentfilter447def do_wordwrap(environment, s, width=79, break_long_words=True):448 """449 Return a copy of the string passed to the filter wrapped after450 ``79`` characters. You can override this default using the first451 parameter. If you set the second parameter to `false` Jinja will not452 split words apart if they are longer than `width`.453 """454 import textwrap455 return u'\n'.join(textwrap.wrap(s, width=width, expand_tabs=False,455 return environment.newline_sequence.join(textwrap.wrap(s, width=width, expand_tabs=False,456 replace_whitespace=False,457 break_long_words=break_long_words))458459
342 unmodified lines