mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 01:16:35 +03:00
Fix ordering of nested entities
This commit is contained in:
parent
abeb8c4d8d
commit
3b428f97a9
|
@ -124,6 +124,8 @@ def parse(html: str) -> Tuple[str, List[TypeMessageEntity]]:
|
|||
parser = HTMLToTelegramParser()
|
||||
parser.feed(add_surrogate(html))
|
||||
text = strip_text(parser.text, parser.entities)
|
||||
parser.entities.reverse()
|
||||
parser.entities.sort(key=lambda entity: entity.offset)
|
||||
return del_surrogate(text), parser.entities
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user