added comment

This commit is contained in:
rimu 2024-06-04 08:51:32 +12:00
parent ff43df1a21
commit 82704ae421

View file

@ -191,6 +191,7 @@ def allowlist_html(html: str) -> str:
url = False url = False
for t in re_url.split(tag.string): for t in re_url.split(tag.string):
if re_url.match(t): if re_url.match(t):
# Avoid picking up trailing punctuation for raw URLs in text
href = t[:-1] if t[-1] in ['.', ',', ')', '!', ':', ';', '?'] else t href = t[:-1] if t[-1] in ['.', ',', ')', '!', ':', ';', '?'] else t
a = soup.new_tag("a", href=href) a = soup.new_tag("a", href=href)
a.string = href a.string = href