From 8bbd1f7db14b4eb4522b79d000cea9c326c4b039 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 7 Mar 2018 14:12:37 +0200 Subject: [PATCH] Fix duplicate unicode formatting when mixing strikethrough and underline --- mautrix_telegram/formatter/from_matrix.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mautrix_telegram/formatter/from_matrix.py b/mautrix_telegram/formatter/from_matrix.py index 842ee3ba..b5dee1d6 100644 --- a/mautrix_telegram/formatter/from_matrix.py +++ b/mautrix_telegram/formatter/from_matrix.py @@ -161,11 +161,12 @@ class MatrixParser(HTMLParser): elif previous_tag == "command": text = f"/{text}" - # Strikethrough - if "del" in self._open_tags: + strikethrough, underline = "del" in self._open_tags, "u" in self._open_tags + if strikethrough and underline: + text = html_to_unicode(text, "\u0336\u0332") + elif strikethrough: text = html_to_unicode(text, "\u0336") - # Underline - if "u" in self._open_tags: + elif underline: text = html_to_unicode(text, "\u0332") list_entry_handled_once = False