diff --git a/django/utils/text.py b/django/utils/text.py
index 14555dd..eaafb96 100644
a
|
b
|
capfirst = lambda x: x and force_unicode(x)[0].upper() + force_unicode(x)[1:]
|
18 | 18 | capfirst = allow_lazy(capfirst, unicode) |
19 | 19 | |
20 | 20 | # Set up regular expressions |
21 | | re_words = re.compile(r'&.*?;|<.*?>|(\w[\w-]*)', re.U) |
22 | | re_tag = re.compile(r'<(/)?([^ ]+?)(?: (/)| .*?)?>') |
| 21 | re_words = re.compile(r'&.*?;|<.*?>|(\w[\w-]*)', re.U|re.S) |
| 22 | re_tag = re.compile(r'<(/)?([^ ]+?)(?: (/)| .*?)?>', re.S) |
23 | 23 | |
24 | 24 | |
25 | 25 | def wrap(text, width): |
diff --git a/tests/regressiontests/utils/text.py b/tests/regressiontests/utils/text.py
index d4aa53f..aae7533 100644
a
|
b
|
class TestUtilsText(unittest.TestCase):
|
62 | 62 | '</strong></p>', truncator.words(4, '....', html=True)) |
63 | 63 | self.assertEqual(u'<p><strong><em>The quick brown fox</em></strong>' |
64 | 64 | '</p>', truncator.words(4, '', html=True)) |
| 65 | # Test with new line inside tag |
| 66 | truncator = text.Truncator('<p>The quick <a href="xyz.html"\n' |
| 67 | 'id="mylink">brown fox</a> jumped over the lazy dog.</p>') |
| 68 | self.assertEqual(u'<p>The quick <a href="xyz.html"\n' |
| 69 | 'id="mylink">brown...</a></p>', truncator.words(3, '...', html=True)) |
65 | 70 | |
66 | 71 | def test_old_truncate_words(self): |
67 | 72 | self.assertEqual(u'The quick brown fox jumped over the lazy dog.', |