mirror of
https://github.com/LaurenceWarne/qute-code-hint
synced 2024-11-11 13:10:50 +00:00
Fix issue with code blocks not copying due to ET parser issue
Co-authored-by: daru <darupeter@pm.me>
This commit is contained in:
parent
b89233022a
commit
a9d8f5a513
@ -19,7 +19,12 @@ else:
|
|||||||
|
|
||||||
|
|
||||||
def parse_text_content(element):
|
def parse_text_content(element):
|
||||||
root = ET.fromstring(element)
|
# https://stackoverflow.com/a/35591507/15245191
|
||||||
|
magic = '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
|
||||||
|
<!ENTITY nbsp ' '>
|
||||||
|
]>'''
|
||||||
|
root = ET.fromstring(magic + element)
|
||||||
text = ET.tostring(root, encoding="unicode", method="text")
|
text = ET.tostring(root, encoding="unicode", method="text")
|
||||||
text = html.unescape(text)
|
text = html.unescape(text)
|
||||||
return text
|
return text
|
||||||
|
Loading…
Reference in New Issue
Block a user