# HG changeset patch # User Marcin Kuzminski # Date 1361811318 -3600 # Node ID 1ca82b6a63491f9d5ba3a71104efcc0f2ee4cfcc # Parent 64c194492aad2100403918f7b1882c3fb2fc36c6 urlify commit function also should extract normal links diff -r 64c194492aad -r 1ca82b6a6349 rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py Mon Feb 25 17:16:45 2013 +0100 +++ b/rhodecode/lib/helpers.py Mon Feb 25 17:55:18 2013 +0100 @@ -978,6 +978,11 @@ def urlify_text(text_): + """ + Extrac urls from text and make html links out of them + + :param text_: + """ url_pat = re.compile(r'''(http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]''' '''|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)''') @@ -994,7 +999,7 @@ Extract revision ids from changeset and make link from them :param text_: - :param repository: + :param repository: repo name to build the URL with """ from pylons import url # doh, we need to re-import url to mock it later URL_PAT = re.compile(r'(?:^|\s)([0-9a-fA-F]{12,40})(?:$|\s)') @@ -1037,6 +1042,7 @@ :param link_: changeset link """ import traceback + from pylons import url # doh, we need to re-import url to mock it later def escaper(string): return string.replace('<', '<').replace('>', '>') @@ -1055,6 +1061,9 @@ # urlify changesets - extrac revisions and make link out of them newtext = urlify_changesets(escaper(text_), repository) + # extract http/https links and make them real urls + newtext = urlify_text(newtext) + try: from rhodecode import CONFIG conf = CONFIG