##// END OF EJS Templates
urlify commit function also should extract normal links
marcink -
r3398:1ca82b6a beta
parent child Browse files
Show More
@@ -978,6 +978,11 b' def fancy_file_stats(stats):'
978
978
979
979
980 def urlify_text(text_):
980 def urlify_text(text_):
981 """
982 Extrac urls from text and make html links out of them
983
984 :param text_:
985 """
981
986
982 url_pat = re.compile(r'''(http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]'''
987 url_pat = re.compile(r'''(http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]'''
983 '''|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)''')
988 '''|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)''')
@@ -994,7 +999,7 b' def urlify_changesets(text_, repository)'
994 Extract revision ids from changeset and make link from them
999 Extract revision ids from changeset and make link from them
995
1000
996 :param text_:
1001 :param text_:
997 :param repository:
1002 :param repository: repo name to build the URL with
998 """
1003 """
999 from pylons import url # doh, we need to re-import url to mock it later
1004 from pylons import url # doh, we need to re-import url to mock it later
1000 URL_PAT = re.compile(r'(?:^|\s)([0-9a-fA-F]{12,40})(?:$|\s)')
1005 URL_PAT = re.compile(r'(?:^|\s)([0-9a-fA-F]{12,40})(?:$|\s)')
@@ -1037,6 +1042,7 b' def urlify_commit(text_, repository=None'
1037 :param link_: changeset link
1042 :param link_: changeset link
1038 """
1043 """
1039 import traceback
1044 import traceback
1045 from pylons import url # doh, we need to re-import url to mock it later
1040
1046
1041 def escaper(string):
1047 def escaper(string):
1042 return string.replace('<', '&lt;').replace('>', '&gt;')
1048 return string.replace('<', '&lt;').replace('>', '&gt;')
@@ -1055,6 +1061,9 b' def urlify_commit(text_, repository=None'
1055 # urlify changesets - extrac revisions and make link out of them
1061 # urlify changesets - extrac revisions and make link out of them
1056 newtext = urlify_changesets(escaper(text_), repository)
1062 newtext = urlify_changesets(escaper(text_), repository)
1057
1063
1064 # extract http/https links and make them real urls
1065 newtext = urlify_text(newtext)
1066
1058 try:
1067 try:
1059 from rhodecode import CONFIG
1068 from rhodecode import CONFIG
1060 conf = CONFIG
1069 conf = CONFIG
General Comments 0
You need to be logged in to leave comments. Login now