strip implicit span from copy&paste (#777)

This commit is contained in:
Damien Elmes 2013-05-16 17:45:36 +09:00
parent c8f4d3a582
commit 69e38b18e1

View file

@ -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