changeset 6188:f486d1d27025

helpers: move linkify_others out of urlify_issues - it is almost always relevant
author Mads Kiilerich <madski@unity3d.com>
date Tue, 06 Sep 2016 00:51:18 +0200
parents 923db690b56f
children 1717a7a4ae0c
files kallithea/lib/helpers.py
diffstat 1 files changed, 5 insertions(+), 6 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
@@ -1321,7 +1321,10 @@
     s = html_escape(s)
     s = _urlify(s)
     if repo_name is not None:
-        s = urlify_issues(s, repo_name, link_)
+        s = urlify_issues(s, repo_name)
+    if link_ is not None:
+        # make href around everything that isn't a href already
+        s = linkify_others(s, link_)
     s = s.replace('\r\n', '<br/>').replace('\n', '<br/>')
     return literal(s)
 
@@ -1368,7 +1371,7 @@
     return urlify_issues_replace
 
 
-def urlify_issues(newtext, repo_name, link_=None):
+def urlify_issues(newtext, repo_name):
     from kallithea import CONFIG as conf
 
     # allow multiple issue servers to be used
@@ -1398,10 +1401,6 @@
         newtext = URL_PAT.sub(urlify_issues_replace, newtext)
         log.debug('processed prefix:`%s` => %s', pattern_index, newtext)
 
-    # if we actually did something above
-    if link_:
-        # wrap not links into final link => link_
-        newtext = linkify_others(newtext, link_)
     return newtext