mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
EPUB3 Input: Fix cover image not being correctly detected in EPUB 3 files that use a deprecated <guide> element that incorrectly identifies the titlepage as the cover. Fixes #1746794 [EPUB -> MOBI conversion removes entire frontmatter, and also drops cover image](https://bugs.launchpad.net/calibre/+bug/1746794)
This commit is contained in:
parent
500a1e00c0
commit
fe0e9a18bb
@ -80,14 +80,14 @@ class EPUBInput(InputFormatPlugin):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def set_guide_type(self, opf, gtype, href=None, title=''):
|
def set_guide_type(self, opf, gtype, href=None, title=''):
|
||||||
# Set the titlepage guide entry
|
# Set the specified guide entry
|
||||||
for elem in list(opf.iterguide()):
|
for elem in list(opf.iterguide()):
|
||||||
if elem.get('type', '').lower() == 'titlepage':
|
if elem.get('type', '').lower() == gtype:
|
||||||
elem.getparent().remove(elem)
|
elem.getparent().remove(elem)
|
||||||
|
|
||||||
if href is not None:
|
if href is not None:
|
||||||
t = opf.create_guide_item(gtype, title, href)
|
t = opf.create_guide_item(gtype, title, href)
|
||||||
for guide in opf.root.iterchildren('guide'):
|
for guide in opf.root.xpath('./*[local-name()="guide"]'):
|
||||||
guide.append(t)
|
guide.append(t)
|
||||||
return
|
return
|
||||||
guide = opf.create_guide_element()
|
guide = opf.create_guide_element()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user