mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
strip implicit span from copy&paste (#777)
This commit is contained in:
parent
c8f4d3a582
commit
69e38b18e1
1 changed files with 9 additions and 0 deletions
|
@ -307,6 +307,15 @@ def _filterHTML(html):
|
||||||
for elem in "html", "head", "body", "meta":
|
for elem in "html", "head", "body", "meta":
|
||||||
for tag in doc(elem):
|
for tag in doc(elem):
|
||||||
tag.replaceWithChildren()
|
tag.replaceWithChildren()
|
||||||
|
# remove outer styling if implicit
|
||||||
|
if doc.span:
|
||||||
|
hadExtraAttr = False
|
||||||
|
for attr in doc.span['style'].split(";"):
|
||||||
|
attr = attr.strip()
|
||||||
|
if attr and attr not in ("font-style: normal", "font-weight: normal"):
|
||||||
|
hadExtraAttr = True
|
||||||
|
if hadExtraAttr:
|
||||||
|
doc.span.replaceWithChildren()
|
||||||
html = unicode(doc)
|
html = unicode(doc)
|
||||||
return html
|
return html
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue