Add strikethrough/underline <-> unicode converter to formatter

This commit is contained in:
Tulir Asokan
2018-03-07 14:03:38 +02:00
parent 13dddb4c10
commit a6f26c16fc
3 changed files with 46 additions and 3 deletions
+4 -1
View File
@@ -23,7 +23,7 @@ from mautrix_appservice import MatrixRequestError
from .. import user as u, puppet as pu, portal as po
from ..db import Message as DBMessage
from .util import (add_surrogates, remove_surrogates, trim_reply_fallback_html,
trim_reply_fallback_text)
trim_reply_fallback_text, unicode_to_html)
log = logging.getLogger("mau.fmt.tg")
@@ -138,6 +138,9 @@ async def telegram_to_matrix(evt, source, main_intent=None, is_edit=False):
text += f"\n- {evt.post_author}"
html += f"<br/><i>- <u>{evt.post_author}</u></i>"
html = unicode_to_html(text, html, "\u0336", "del")
html = unicode_to_html(text, html, "\u0332", "u")
if html:
html = html.replace("\n", "<br/>")