mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
f8fcc9cb76
commit
f090abb46b
@ -1081,6 +1081,15 @@ class OPF(object): # {{{
|
|||||||
return elem
|
return elem
|
||||||
|
|
||||||
def render(self, encoding='utf-8'):
|
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()
|
self.write_user_metadata()
|
||||||
raw = etree.tostring(self.root, encoding=encoding, pretty_print=True)
|
raw = etree.tostring(self.root, encoding=encoding, pretty_print=True)
|
||||||
if not raw.lstrip().startswith('<?xml '):
|
if not raw.lstrip().startswith('<?xml '):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user