mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-02 13:34:51 +00:00
Strip whitespace characters from the end of the message
but preserve closing tags
This commit is contained in:
parent
b4467e82af
commit
d82e9468f0
1 changed files with 3 additions and 2 deletions
|
|
@ -111,10 +111,11 @@ class HTML:
|
|||
self.client = client
|
||||
|
||||
def parse(self, text: str):
|
||||
text = utils.add_surrogates(text)
|
||||
# Strip whitespace characters from the end of the message, but preserve closing tags
|
||||
text = re.sub(r"\s*(</[\w\W]*>)\s*$", r"\1", text)
|
||||
|
||||
parser = Parser(self.client)
|
||||
parser.feed(text)
|
||||
parser.feed(utils.add_surrogates(text))
|
||||
parser.close()
|
||||
|
||||
if parser.tag_entities:
|
||||
|
|
|
|||
Loading…
Reference in a new issue