Merge pull request #216 from ljosa/ticket_18644
Fixed #18644 -- Made urlize trim trailing period followed by parenthesis
This commit is contained in:
commit
59d99772f0
|
@ -17,7 +17,7 @@ from django.utils import six
|
||||||
from django.utils.text import normalize_newlines
|
from django.utils.text import normalize_newlines
|
||||||
|
|
||||||
# Configuration for urlize() function.
|
# Configuration for urlize() function.
|
||||||
TRAILING_PUNCTUATION = ['.', ',', ':', ';']
|
TRAILING_PUNCTUATION = ['.', ',', ':', ';', '.)']
|
||||||
WRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('<', '>')]
|
WRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('<', '>')]
|
||||||
|
|
||||||
# List of possible strings used for bullets in bulleted lists.
|
# List of possible strings used for bullets in bulleted lists.
|
||||||
|
|
|
@ -298,6 +298,10 @@ class DefaultFiltersTests(TestCase):
|
||||||
self.assertEqual(urlize('HTTPS://github.com/'),
|
self.assertEqual(urlize('HTTPS://github.com/'),
|
||||||
'<a href="https://github.com/" rel="nofollow">HTTPS://github.com/</a>')
|
'<a href="https://github.com/" rel="nofollow">HTTPS://github.com/</a>')
|
||||||
|
|
||||||
|
# Check urlize trims trailing period when followed by parenthesis - see #18644
|
||||||
|
self.assertEqual(urlize('(Go to http://www.example.com/foo.)'),
|
||||||
|
'(Go to <a href="http://www.example.com/foo" rel="nofollow">http://www.example.com/foo</a>.)')
|
||||||
|
|
||||||
def test_wordcount(self):
|
def test_wordcount(self):
|
||||||
self.assertEqual(wordcount(''), 0)
|
self.assertEqual(wordcount(''), 0)
|
||||||
self.assertEqual(wordcount('oneword'), 1)
|
self.assertEqual(wordcount('oneword'), 1)
|
||||||
|
|
Loading…
Reference in New Issue