Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #3714 -- Fixed handling of indented text in wordwrap template f…

…ilter. Thanks for the fix, Ian Clelland.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4753 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b8eec54041040eccbd4d6d1077257b65cdb85708 1 parent 83bed03
Russell Keith-Magee authored March 20, 2007
2  django/utils/text.py
@@ -17,7 +17,7 @@ def _generator():
17 17
         pos = len(word) - word.rfind('\n') - 1
18 18
         for word in it:
19 19
             if "\n" in word:
20  
-                lines = word.splitlines()
  20
+                lines = word.split('\n')
21 21
             else:
22 22
                 lines = (word,)
23 23
             pos += len(lines[0]) + 1
6  tests/regressiontests/defaultfilters/tests.py
@@ -133,6 +133,12 @@
133 133
 >>> wordwrap('this is a long paragraph of text that really needs to be wrapped I\'m afraid', 14)
134 134
 "this is a long\nparagraph of\ntext that\nreally needs\nto be wrapped\nI'm afraid"
135 135
 
  136
+>>> wordwrap('this is a short paragraph of text.\n  But this line should be indented',14)
  137
+'this is a\nshort\nparagraph of\ntext.\n  But this\nline should be\nindented'
  138
+
  139
+>>> wordwrap('this is a short paragraph of text.\n  But this line should be indented',15)
  140
+'this is a short\nparagraph of\ntext.\n  But this line\nshould be\nindented'
  141
+
136 142
 >>> ljust('test', 10)
137 143
 'test      '
138 144
 

0 notes on commit b8eec54

Please sign in to comment.
Something went wrong with that request. Please try again.