Skip to content
This repository

wordwrap filter should use the newline_sequence defined in current Environment #30

Merged
merged 1 commit into from about 3 years ago

2 participants

Frederic De Groef Armin Ronacher
Frederic De Groef
sevas commented

wordwrap filter should use the newline_sequence defined in current Environment object

(see mitsuhiko/jinja2#29)

Armin Ronacher mitsuhiko merged commit 7c97352 into from
Armin Ronacher mitsuhiko closed this
Armin Ronacher
Owner

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

May 01, 2011
Frederic De Groef sevas wordwrap filter should use the newline_sequence defined in current En…
…vironment object
218cb64
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 3 additions and 3 deletions. Show diff stats Hide diff stats

  1. +3 3 jinja2/filters.py
6 jinja2/filters.py
@@ -443,8 +443,8 @@ def do_truncate(s, length=255, killwords=False, end='...'):
443 443 result.append(end)
444 444 return u' '.join(result)
445 445
446   -
447   -def do_wordwrap(s, width=79, break_long_words=True):
  446 +@environmentfilter
  447 +def do_wordwrap(environment, s, width=79, break_long_words=True):
448 448 """
449 449 Return a copy of the string passed to the filter wrapped after
450 450 ``79`` characters. You can override this default using the first
@@ -452,7 +452,7 @@ def do_wordwrap(s, width=79, break_long_words=True):
452 452 split words apart if they are longer than `width`.
453 453 """
454 454 import textwrap
455   - 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 456 replace_whitespace=False,
457 457 break_long_words=break_long_words))
458 458

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.