mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
patch from Chris Burel, fix qt html rewriting on 4.6.1+
This commit is contained in:
parent
7111b3b924
commit
27694adf1a
1 changed files with 5 additions and 3 deletions
|
@ -137,9 +137,10 @@ def tidyHTML(html):
|
|||
html = re.sub(u".*<body.*?>(.*)</body></html>",
|
||||
"\\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'<p( style=.+?)>(.*?)</p>', u'<span\\1>\\2</span><br>', html)
|
||||
html = re.sub(u'<p>(.*?)</p>', u'\\1<br>', html)
|
||||
html = re.sub(u'<br>$', u'', html)
|
||||
html = re.sub(u"^<table><tr><td style=\"border: none;\">(.*)<br></td></tr></table>$", u"\\1", html)
|
||||
return html
|
||||
|
||||
# IDs
|
||||
|
|
Loading…
Reference in a new issue