Changeset - 32e1e0745d3c
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 14 years ago 2012-01-19 02:47:48
marcin@python-works.com
fixes issue with whitespace for referenced tasks in commit messages
1 file changed with 6 insertions and 1 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/helpers.py
Show inline comments
 
@@ -739,63 +739,68 @@ def urlify_text(text_):
 
    def url_func(match_obj):
 
        url_full = match_obj.groups()[0]
 
        return '<a href="%(url)s">%(url)s</a>' % ({'url': url_full})
 

	
 
    return literal(url_pat.sub(url_func, text_))
 

	
 

	
 
def urlify_commit(text_, repository=None, link_=None):
 
    import re
 
    import traceback
 

	
 
    if link_:
 
        link_ = '<a href="' + link_ + '">'
 

	
 
    try:
 
        conf = config['app_conf']
 

	
 
        URL_PAT = re.compile(r'%s' % conf.get('url_pat'))
 

	
 
        if URL_PAT:
 
            ISSUE_SERVER_LNK = conf.get('issue_server_link')
 
            ISSUE_PREFIX = conf.get('issue_prefix')
 

	
 
            def url_func(match_obj):
 
                pref = ''
 
                if match_obj.group().startswith(' '):
 
                    pref = ' '
 

	
 
                issue_id = match_obj.groups()[0]
 
                tmpl = (
 
                ' <a class="%(cls)s" href="%(url)s">'
 
                '%(pref)s<a class="%(cls)s" href="%(url)s">'
 
                '%(issue-prefix)s%(id-repr)s'
 
                '</a>'
 
                )
 
                url = ISSUE_SERVER_LNK.replace('{id}', issue_id)
 
                if repository:
 
                    url = url.replace('{repo}', repository)
 

	
 
                if link_:
 
                    tmpl = '</a>' + tmpl + link_
 

	
 
                return tmpl % (
 
                    {
 
                     'pref': pref,
 
                     'cls': 'issue-tracker-link',
 
                     'url': url,
 
                     'id-repr': issue_id,
 
                     'issue-prefix': ISSUE_PREFIX,
 
                     'serv': ISSUE_SERVER_LNK,
 
                    }
 
                )
 
            newtext = URL_PAT.sub(url_func, text_)
 
            if link_:
 
                newtext = link_ + newtext + '</a>'
 
            return literal(newtext)
 
    except:
 
        log.error(traceback.format_exc())
 
        pass
 

	
 
    return text_
 

	
 

	
 
def rst(source):
 
    return literal('<div class="rst-block">%s</div>' %
 
                   MarkupRenderer.rst(source))
 

	
 

	
 
def rst_w_mentions(source):
0 comments (0 inline, 0 general)