Loading django/utils/html.py +4 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ unencoded_ampersands_re = re.compile(r'&(?!(\w+|#\d+);)') unquoted_percents_re = re.compile(r'%(?![0-9A-Fa-f]{2})') word_split_re = re.compile(r'(\s+)') simple_url_re = re.compile(r'^https?://\w') simple_url_2_re = re.compile(r'^www\.|^(?!http)\w[^@]+\.(com|edu|gov|int|mil|net|org|[a-z]{2})$') simple_url_2_re = re.compile(r'^www\.|^(?!http)\w[^@]+\.(com|edu|gov|int|mil|net|org)$') simple_email_re = re.compile(r'^\S+@\S+\.\S+$') link_target_attribute_re = re.compile(r'(<a [^>]*?)target=[^\s>]+') html_gunk_re = re.compile(r'(?:<br clear="all">|<i><\/i>|<b><\/b>|<em><\/em>|<strong><\/strong>|<\/?smallcaps>|<\/?uppercase>)', re.IGNORECASE) Loading Loading @@ -125,10 +125,9 @@ def urlize(text, trim_url_limit=None, nofollow=False, autoescape=False): Converts any URLs in text into clickable links. Works on http://, https://, www. links, and also on links ending in one of the original seven gTLDs (.com, .edu, .gov, .int, .mil, .net, and .org) or a two-letter ccTLD. Links can have trailing punctuation (periods, commas, close-parens) and leading punctuation (opening parens) and it'll still do the right thing. the original seven gTLDs (.com, .edu, .gov, .int, .mil, .net, and .org). Links can have trailing punctuation (periods, commas, close-parens) and leading punctuation (opening parens) and it'll still do the right thing. If trim_url_limit is not None, the URLs in link text longer than this limit will truncated to trim_url_limit-3 characters and appended with an elipsis. Loading docs/ref/templates/builtins.txt +7 −9 Original line number Diff line number Diff line Loading @@ -2226,15 +2226,13 @@ urlize Converts URLs in text into clickable links. This template tag works on several kinds of links: - links prefixed with ``http://``, ``https://``, or ``www.``. For example, ``http://goo.gl/aia1t`` will get converted but ``goo.gl/aia1t`` won't. - domain-only links ending in one of the original top level domains (``.com``, ``.edu``, ``.gov``, ``.int``, ``.mil``, ``.net``, and ``.org``). For example, ``djangoproject.com`` also gets converted. - domain-only links ending in a dot followed by two letters. This covers most country codes. For example, ``djangocon.eu`` still gets converted. This template tag works on links prefixed with ``http://``, ``https://``, or ``www.``. For example, ``http://goo.gl/aia1t`` will get converted but ``goo.gl/aia1t`` won't. It also supports domain-only links ending in one of the original top level domains (``.com``, ``.edu``, ``.gov``, ``.int``, ``.mil``, ``.net``, and ``.org``). For example, ``djangoproject.com`` gets converted too. .. versionchanged:: 1.4 Loading tests/regressiontests/defaultfilters/tests.py +0 −2 Original line number Diff line number Diff line Loading @@ -287,8 +287,6 @@ class DefaultFiltersTests(TestCase): # Check urlize accepts more TLDs - see #16656 self.assertEqual(urlize('usa.gov'), u'<a href="http://usa.gov" rel="nofollow">usa.gov</a>') self.assertEqual(urlize('europa.eu'), u'<a href="http://europa.eu" rel="nofollow">europa.eu</a>') def test_wordcount(self): self.assertEqual(wordcount(''), 0) Loading Loading
django/utils/html.py +4 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ unencoded_ampersands_re = re.compile(r'&(?!(\w+|#\d+);)') unquoted_percents_re = re.compile(r'%(?![0-9A-Fa-f]{2})') word_split_re = re.compile(r'(\s+)') simple_url_re = re.compile(r'^https?://\w') simple_url_2_re = re.compile(r'^www\.|^(?!http)\w[^@]+\.(com|edu|gov|int|mil|net|org|[a-z]{2})$') simple_url_2_re = re.compile(r'^www\.|^(?!http)\w[^@]+\.(com|edu|gov|int|mil|net|org)$') simple_email_re = re.compile(r'^\S+@\S+\.\S+$') link_target_attribute_re = re.compile(r'(<a [^>]*?)target=[^\s>]+') html_gunk_re = re.compile(r'(?:<br clear="all">|<i><\/i>|<b><\/b>|<em><\/em>|<strong><\/strong>|<\/?smallcaps>|<\/?uppercase>)', re.IGNORECASE) Loading Loading @@ -125,10 +125,9 @@ def urlize(text, trim_url_limit=None, nofollow=False, autoescape=False): Converts any URLs in text into clickable links. Works on http://, https://, www. links, and also on links ending in one of the original seven gTLDs (.com, .edu, .gov, .int, .mil, .net, and .org) or a two-letter ccTLD. Links can have trailing punctuation (periods, commas, close-parens) and leading punctuation (opening parens) and it'll still do the right thing. the original seven gTLDs (.com, .edu, .gov, .int, .mil, .net, and .org). Links can have trailing punctuation (periods, commas, close-parens) and leading punctuation (opening parens) and it'll still do the right thing. If trim_url_limit is not None, the URLs in link text longer than this limit will truncated to trim_url_limit-3 characters and appended with an elipsis. Loading
docs/ref/templates/builtins.txt +7 −9 Original line number Diff line number Diff line Loading @@ -2226,15 +2226,13 @@ urlize Converts URLs in text into clickable links. This template tag works on several kinds of links: - links prefixed with ``http://``, ``https://``, or ``www.``. For example, ``http://goo.gl/aia1t`` will get converted but ``goo.gl/aia1t`` won't. - domain-only links ending in one of the original top level domains (``.com``, ``.edu``, ``.gov``, ``.int``, ``.mil``, ``.net``, and ``.org``). For example, ``djangoproject.com`` also gets converted. - domain-only links ending in a dot followed by two letters. This covers most country codes. For example, ``djangocon.eu`` still gets converted. This template tag works on links prefixed with ``http://``, ``https://``, or ``www.``. For example, ``http://goo.gl/aia1t`` will get converted but ``goo.gl/aia1t`` won't. It also supports domain-only links ending in one of the original top level domains (``.com``, ``.edu``, ``.gov``, ``.int``, ``.mil``, ``.net``, and ``.org``). For example, ``djangoproject.com`` gets converted too. .. versionchanged:: 1.4 Loading
tests/regressiontests/defaultfilters/tests.py +0 −2 Original line number Diff line number Diff line Loading @@ -287,8 +287,6 @@ class DefaultFiltersTests(TestCase): # Check urlize accepts more TLDs - see #16656 self.assertEqual(urlize('usa.gov'), u'<a href="http://usa.gov" rel="nofollow">usa.gov</a>') self.assertEqual(urlize('europa.eu'), u'<a href="http://europa.eu" rel="nofollow">europa.eu</a>') def test_wordcount(self): self.assertEqual(wordcount(''), 0) Loading