From 824725a6989723f297adb98e9dc8f918f2bf82ed Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 28 Apr 2018 21:29:11 +0300 Subject: [PATCH] Remove unnecessary newlines from some places. Fixes #113 --- mautrix_telegram/formatter/from_matrix.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mautrix_telegram/formatter/from_matrix.py b/mautrix_telegram/formatter/from_matrix.py index 318baf54..9fee65b3 100644 --- a/mautrix_telegram/formatter/from_matrix.py +++ b/mautrix_telegram/formatter/from_matrix.py @@ -128,7 +128,7 @@ class MatrixParser(HTMLParser): self._open_tags_meta.popleft() self._open_tags_meta.appendleft(url) - if tag in self.block_tags: + if tag in self.block_tags and ("blockquote" not in self._open_tags or tag == "br"): self._newline() if entity_type and tag not in self._building_entities: @@ -241,7 +241,7 @@ class MatrixParser(HTMLParser): if entity: self.entities.append(entity) - if tag in self.block_tags: + if tag in self.block_tags and tag != "br" and "blockquote" not in self._open_tags: self._newline(allow_multi=tag == "br")