mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-01 21:24:50 +00:00
Fix entities unparsing in other scenarios (#892)
This commit is contained in:
parent
855e69e3f8
commit
b3f849df76
1 changed files with 10 additions and 1 deletions
|
|
@ -174,8 +174,17 @@ class HTML:
|
|||
|
||||
entities_offsets.append((start_tag, start,))
|
||||
entities_offsets.append((end_tag, end,))
|
||||
|
||||
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 reversed(entities_offsets):
|
||||
for entity, offset in entities_offsets:
|
||||
text = text[:offset] + entity + text[offset:]
|
||||
|
||||
return utils.remove_surrogates(text)
|
||||
|
|
|
|||
Loading…
Reference in a new issue