diff --git a/anki/utils.py b/anki/utils.py index 6d22c1af5..f5f95830d 100644 --- a/anki/utils.py +++ b/anki/utils.py @@ -137,9 +137,10 @@ def tidyHTML(html): html = re.sub(u".*(.*)", "\\1", html.replace("\n", u"")) # strip superfluous Qt formatting - html = re.sub(u"margin-top:\d+px; margin-bottom:\d+px; margin-left:\d+px; " - "margin-right:\d+px; -qt-block-indent:0; " - "text-indent:0px;", u"", html) + html = re.sub(u"(?:-qt-table-type: root; )?" + "margin-top:\d+px; margin-bottom:\d+px; margin-left:\d+px; " + "margin-right:\d+px;(?: -qt-block-indent:0; " + "text-indent:0px;)?", u"", html) html = re.sub(u"-qt-paragraph-type:empty;", u"", html) # strip leading space in style statements, and remove if no contents html = re.sub(u'style=" ', u'style="', html) @@ -148,6 +149,7 @@ def tidyHTML(html): html = re.sub(u'(.*?)

', u'\\2
', html) html = re.sub(u'

(.*?)

', u'\\1
', html) html = re.sub(u'
$', u'', html) + html = re.sub(u"^
(.*)
$", u"\\1", html) return html # IDs