fix add_link

This commit is contained in:
j 2024-03-20 12:55:14 +01:00
parent 7461719e23
commit 99554cb461

View file

@ -16,7 +16,7 @@ TRAILING_PUNCTUATION = ['.', ',', ')', '>', '\n', '>', "'", '"']
DOTS = ['·', '*', '\xe2\x80\xa2', '•', '•', '•']
unencoded_ampersands_re = re.compile(r'&(?!(\w+|#\d+);)')
word_split_re = re.compile(r'(\s+)')
word_split_re = re.compile(r'(\s+|<br>)')
punctuation_re = re.compile('^(?P<lead>(?:%s)*)(?P<middle>.*?)(?P<trail>(?:%s)*)$' % (
'|'.join([re.escape(x) for x in LEADING_PUNCTUATION]),
'|'.join([re.escape(x) for x in TRAILING_PUNCTUATION])))
@ -393,7 +393,7 @@ def sanitize_html(html, tags=None, global_attributes=[]):
parts[i] = escape_html(decode_html(part))
html = ''.join(parts)
html = add_links(html)
html = html.replace('\n\n', '<br/><br/>')
html = html.replace('\n\n', '<br><br>')
return sanitize_fragment(html)
def split_tags(string):