This commit is contained in:
Kovid Goyal 2010-11-08 10:11:22 -07:00
parent 2d6b895a90
commit 7711d58021
3 changed files with 111 additions and 2 deletions

View File

@ -444,6 +444,9 @@ xml_entity_to_unicode = partial(entity_to_unicode, result_exceptions = {
def replace_entities(raw): def replace_entities(raw):
return _ent_pat.sub(entity_to_unicode, raw) return _ent_pat.sub(entity_to_unicode, raw)
def xml_replace_entities(raw):
return _ent_pat.sub(xml_entity_to_unicode, raw)
def prepare_string_for_xml(raw, attribute=False): def prepare_string_for_xml(raw, attribute=False):
raw = _ent_pat.sub(entity_to_unicode, raw) raw = _ent_pat.sub(entity_to_unicode, raw)
raw = raw.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;') raw = raw.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')

View File

@ -213,11 +213,13 @@ class BookInfo(QWebView):
f = QFontInfo(QApplication.font(self.parent())).pixelSize() f = QFontInfo(QApplication.font(self.parent())).pixelSize()
p = unicode(QApplication.palette().color(QPalette.Normal, p = unicode(QApplication.palette().color(QPalette.Normal,
QPalette.Base).name()) QPalette.Base).name())
c = unicode(QApplication.palette().color(QPalette.Normal,
QPalette.Text).name())
templ = u'''\ templ = u'''\
<html> <html>
<head> <head>
<style type="text/css"> <style type="text/css">
body, td {background-color: %s; font-size: %dpx} body, td {background-color: %s; font-size: %dpx; color: %s }
a { text-decoration: none; color: blue } a { text-decoration: none; color: blue }
</style> </style>
</head> </head>
@ -225,7 +227,7 @@ class BookInfo(QWebView):
%%s %%s
</body> </body>
<html> <html>
'''%(p, f) '''%(p, f, c)
if self.vertical: if self.vertical:
if comments: if comments:
rows += u'<tr><td colspan="2">%s</td></tr>'%comments rows += u'<tr><td colspan="2">%s</td></tr>'%comments

File diff suppressed because one or more lines are too long