Fix dashes in links.

part of CURA-8565 and/or CURA-8585
This commit is contained in:
Remco Burema 2021-12-01 14:01:41 +01:00
parent c1298c6a5e
commit 518e59303d
No known key found for this signature in database
GPG key ID: 215C49431D43F98C

View file

@ -84,7 +84,7 @@ class PackageModel(QObject):
:return: A block of rich text with formatting embedded.
"""
# Turn all in-line hyperlinks into actual links.
url_regex = re.compile(r"(((http|https)://)[a-zA-Z0-9@:%._+~#?&/=]{2,256}\.[a-z]{2,12}(/[a-zA-Z0-9@:%.-_+~#?&/=]*)?)")
url_regex = re.compile(r"(((http|https)://)[a-zA-Z0-9@:%.\-_+~#?&/=]{2,256}\.[a-z]{2,12}(/[a-zA-Z0-9@:%.\-_+~#?&/=]*)?)")
text = re.sub(url_regex, r'<a href="\1">\1</a>', text)
# Turn newlines into <br> so that they get displayed as newlines when rendering as rich text.