changeset 6189:1717a7a4ae0c

helpers: make linkify_others slightly smarter - don't markup empty space
author Mads Kiilerich <madski@unity3d.com>
date Tue, 06 Sep 2016 00:51:18 +0200
parents f486d1d27025
children 020334bec94b
files kallithea/lib/helpers.py kallithea/tests/other/test_libs.py
diffstat 2 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/helpers.py	Tue Sep 06 00:51:18 2016 +0200
+++ b/kallithea/lib/helpers.py	Tue Sep 06 00:51:18 2016 +0200
@@ -1337,7 +1337,7 @@
     urls = re.compile(r'(\<a.*?\<\/a\>)',)
     links = []
     for e in urls.split(t):
-        if not urls.match(e):
+        if e.strip() and not urls.match(e):
             links.append('<a class="message-link" href="%s">%s</a>' % (l, e))
         else:
             links.append(e)
--- a/kallithea/tests/other/test_libs.py	Tue Sep 06 00:51:18 2016 +0200
+++ b/kallithea/tests/other/test_libs.py	Tue Sep 06 00:51:18 2016 +0200
@@ -362,7 +362,6 @@
 
     @parametrize('sample,expected', [
       ("deadbeefcafe @mention, and http://foo.bar/ yo",
-       """<a class="message-link" href="#the-link"></a>"""
        """<a class="revision-link" href="/repo_name/changeset/deadbeefcafe">deadbeefcafe</a>"""
        """<a class="message-link" href="#the-link"> <b>@mention</b>, and </a>"""
        """<a href="http://foo.bar/">http://foo.bar/</a>"""