# HG changeset patch # User Mads Kiilerich # Date 2015-06-19 18:00:42 # Node ID d60f54b3eeb3d1c98a8b944b4bf0ab607a1fbf3f # Parent 82198c193c114b99fc964b94c87bc7a18db3ff88 helpers: extract internal _urlify_text function from urlify_text diff --git a/kallithea/lib/helpers.py b/kallithea/lib/helpers.py --- a/kallithea/lib/helpers.py +++ b/kallithea/lib/helpers.py @@ -1264,21 +1264,21 @@ def fancy_file_stats(stats): return literal('
%s%s
' % (width, d_a, d_d)) -def urlify_text(text_, safe=True): +def _urlify_text(s): """ Extract urls from text and make html links out of them - - :param text_: """ - def url_func(match_obj): - url_full = match_obj.groups()[0] + url_full = match_obj.group(1) return '%(url)s' % ({'url': url_full}) - _newtext = url_re.sub(url_func, text_) - if safe: - return literal(_newtext) - return _newtext + return url_re.sub(url_func, s) +def urlify_text(s): + """ + Extract urls from text and make literal html links out of them + """ + s = _urlify_text(s) + return literal(s) def urlify_changesets(text_, repository): """ @@ -1325,7 +1325,7 @@ def urlify_commit(text_, repository, lin newtext = urlify_changesets(newtext, repository) # extract http/https links and make them real urls - newtext = urlify_text(newtext, safe=False) + newtext = _urlify_text(newtext) newtext = urlify_issues(newtext, repository, link_)