mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 13:27:47 +00:00
Fix entities unparsing in other scenarios (#892)
This commit is contained in:
parent
855e69e3f8
commit
b3f849df76
@ -175,7 +175,16 @@ class HTML:
|
|||||||
entities_offsets.append((start_tag, start,))
|
entities_offsets.append((start_tag, start,))
|
||||||
entities_offsets.append((end_tag, end,))
|
entities_offsets.append((end_tag, end,))
|
||||||
|
|
||||||
for entity, offset in reversed(entities_offsets):
|
entities_offsets = map(
|
||||||
|
lambda x: x[1],
|
||||||
|
sorted(
|
||||||
|
enumerate(entities_offsets),
|
||||||
|
key = lambda x: (x[1][1], x[0]),
|
||||||
|
reverse = True
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
for entity, offset in entities_offsets:
|
||||||
text = text[:offset] + entity + text[offset:]
|
text = text[:offset] + entity + text[offset:]
|
||||||
|
|
||||||
return utils.remove_surrogates(text)
|
return utils.remove_surrogates(text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user