Update docs

This commit is contained in:
stijnvanhoey 2017-10-03 01:22:27 +02:00
parent 6118aade48
commit 26e8295e80
1 changed files with 1 additions and 4 deletions

View File

@ -174,15 +174,12 @@ class DwcDigester(object):
@staticmethod @staticmethod
def convert_link(text_with_urls): def convert_link(text_with_urls):
"""takes all links in a text field and converts it to the html tagged version of the link """takes all links in a text field and converts it to the html tagged version of the link
Notes
------
The underlying regex is not a general URL matcher and ad-hoc made. Furthermore, it currently handles the end-dot of the description field outside the regex
""" """
def _handle_matched(inputstring): def _handle_matched(inputstring):
"""quick hack version of url handling on the current prime versions data""" """quick hack version of url handling on the current prime versions data"""
url = inputstring.group() url = inputstring.group()
return "<a href=\"{}\">{}</a>".format(url, url) return "<a href=\"{}\">{}</a>".format(url, url)
regx = "(http[s]?://[\w\d:#@%/;$()~_?\+-=\\\.&]*)(?<![\)\.])" regx = "(http[s]?://[\w\d:#@%/;$()~_?\+-=\\\.&]*)(?<![\)\.])"
return re.sub(regx, _handle_matched, text_with_urls) return re.sub(regx, _handle_matched, text_with_urls)