From 69e38b18e1c07bfd9ec4afcabc1b2903be1d70ab Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 16 May 2013 17:45:36 +0900 Subject: [PATCH] strip implicit span from copy&paste (#777) --- aqt/editor.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/aqt/editor.py b/aqt/editor.py index ae2ee919a..0de63c921 100644 --- a/aqt/editor.py +++ b/aqt/editor.py @@ -307,6 +307,15 @@ def _filterHTML(html): for elem in "html", "head", "body", "meta": for tag in doc(elem): 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) return html