Fix Matrix -> Telegram code block bridging

This commit is contained in:
Tulir Asokan
2018-03-07 23:28:36 +02:00
parent 8d1de218a1
commit 96d3ca106a
2 changed files with 5 additions and 4 deletions
+4 -4
View File
@@ -143,7 +143,7 @@ class MatrixParser(HTMLParser):
return indent
def _newline(self, allow_multi=False):
if self._line_is_new or allow_multi:
if self._line_is_new and not allow_multi:
return
self.text += "\n"
self._line_is_new = True
@@ -210,13 +210,13 @@ class MatrixParser(HTMLParser):
except IndexError:
pass
if tag in self.block_tags:
self._newline(allow_multi=tag == "br")
entity = self._building_entities.pop(tag, None)
if entity:
self.entities.append(entity)
if tag in self.block_tags:
self._newline(allow_multi=tag == "br")
command_regex = re.compile("(\s|^)!([A-Za-z0-9@]+)")
+1
View File
@@ -633,6 +633,7 @@ class Portal:
else:
self.log.debug("Unhandled Matrix event: %s", message)
return
self.log.debug("Handled Matrix message: %s", response)
self.is_duplicate(response, (event_id, space))
self.db.add(DBMessage(
tgid=response.id,