Remove redundant <br>'s after block tags when converting from Telegram

This commit is contained in:
Tulir Asokan
2023-10-29 12:06:39 +02:00
parent 90a8583ad0
commit a84e5ebc6a
+5 -1
View File
@@ -348,7 +348,11 @@ async def _telegram_entities_to_matrix(
last_offset = relative_offset + (0 if skip_entity else entity.length)
html.append(text_to_html(text[last_offset:]))
return "".join(html)
html_string = "".join(html)
# Remove redundant <br>'s after block tags
html_string = html_string.replace("</blockquote><br/>", "</blockquote>")
html_string = html_string.replace("</pre><br/>", "</pre>")
return html_string
def _parse_pre(html: list[str], entity_text: str, language: str) -> bool: