When setting metadata in EPUB ensure that the <meta name=cover> tag has its name attribute first. Needed for the Nook.

This commit is contained in:
Kovid Goyal 2012-02-27 10:39:58 +05:30
parent f8fcc9cb76
commit f090abb46b

View File

@ -1081,6 +1081,15 @@ class OPF(object): # {{{
return elem
def render(self, encoding='utf-8'):
for meta in self.raster_cover_path(self.metadata):
# Ensure that the name attribute occurs before the content
# attribute. Needed for Nooks.
a = meta.attrib
c = a.get('content', None)
if c is not None:
del a['content']
a['content'] = c
self.write_user_metadata()
raw = etree.tostring(self.root, encoding=encoding, pretty_print=True)
if not raw.lstrip().startswith('<?xml '):