mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
misc fixes for last py3 merge
This commit is contained in:
parent
ec4d9f109d
commit
46afc39739
@ -632,7 +632,7 @@ class OEBReader(object):
|
||||
path = os.path.join(tdir, unquote(hcover.href))
|
||||
data = render_html_svg_workaround(path, self.logger)
|
||||
if not data:
|
||||
data = ''
|
||||
data = b''
|
||||
id, href = self.oeb.manifest.generate('cover', 'cover.jpg')
|
||||
item = self.oeb.manifest.add(id, href, JPEG_MIME, data=data)
|
||||
return item
|
||||
|
@ -1,9 +1,9 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
'''
|
||||
CSS property propagation class.
|
||||
'''
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
|
||||
@ -33,7 +33,7 @@ def html_css_stylesheet():
|
||||
global _html_css_stylesheet
|
||||
if _html_css_stylesheet is None:
|
||||
with open(P('templates/html.css'), 'rb') as f:
|
||||
html_css = f.read()
|
||||
html_css = f.read().decode('utf-8')
|
||||
_html_css_stylesheet = parseString(html_css, validate=False)
|
||||
return _html_css_stylesheet
|
||||
|
||||
@ -96,6 +96,7 @@ def test_media_ok():
|
||||
assert media_ok('screen, (device-width:10px)')
|
||||
assert not media_ok('screen and (device-width:10px)')
|
||||
|
||||
|
||||
class StylizerRules(object):
|
||||
|
||||
def __init__(self, opts, profile, stylesheets):
|
||||
@ -181,6 +182,7 @@ class StylizerRules(object):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class Stylizer(object):
|
||||
STYLESHEETS = WeakKeyDictionary()
|
||||
|
||||
@ -280,7 +282,7 @@ class Stylizer(object):
|
||||
stylesheet = parser.parseString(text, href=cssname,
|
||||
validate=False)
|
||||
stylesheets.append(stylesheet)
|
||||
except:
|
||||
except Exception:
|
||||
self.logger.exception('Failed to parse %s, ignoring.'%w)
|
||||
self.logger.debug('Bad css: ')
|
||||
self.logger.debug(x)
|
||||
|
@ -1,7 +1,7 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
'''
|
||||
HTML-TOC-adding transform.
|
||||
'''
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
|
||||
|
@ -1,7 +1,7 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
'''
|
||||
CSS case-mangling transform.
|
||||
'''
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
|
||||
|
@ -1,7 +1,7 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
'''
|
||||
SVG rasterization transform.
|
||||
'''
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
|
||||
|
Loading…
x
Reference in New Issue
Block a user