Improve HTML parser

Closes #567
This commit is contained in:
Dan 2020-12-24 19:35:41 +01:00
parent 01a3aab482
commit 0d357fb5a9

View File

@ -111,7 +111,7 @@ class HTML:
async def parse(self, text: str): async def parse(self, text: str):
# Strip whitespace characters from the end of the message, but preserve closing tags # Strip whitespace characters from the end of the message, but preserve closing tags
text = re.sub(r"\s*(</[\w\W]*>)\s*$", r"\1", text) text = re.sub(r"\s+(</[\w\W]*>)\s*$", r"\1", text)
parser = Parser(self.client) parser = Parser(self.client)
parser.feed(utils.add_surrogates(text)) parser.feed(utils.add_surrogates(text))