mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
Fixed error while unparsing consecutive entities (#885)
This commit is contained in:
parent
333d22afca
commit
c7888437e8
1 changed files with 1 additions and 4 deletions
|
|
@ -175,10 +175,7 @@ class HTML:
|
|||
entities_offsets.append((start_tag, start,))
|
||||
entities_offsets.append((end_tag, end,))
|
||||
|
||||
# sorting by offset (desc)
|
||||
entities_offsets.sort(key=lambda x: -x[1])
|
||||
|
||||
for entity, offset in entities_offsets:
|
||||
for entity, offset in reversed(entities_offsets):
|
||||
text = text[:offset] + entity + text[offset:]
|
||||
|
||||
return utils.remove_surrogates(text)
|
||||
|
|
|
|||
Loading…
Reference in a new issue