mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Polishing: Recognize titlepages that are marked as covers in the EPUB 3 landmarks section
This commit is contained in:
parent
0e9991c331
commit
31f642e951
@ -254,8 +254,8 @@ def mark_as_titlepage(container, name, move_to_start=True):
|
|||||||
def find_cover_page(container):
|
def find_cover_page(container):
|
||||||
'Find a document marked as a cover in the OPF'
|
'Find a document marked as a cover in the OPF'
|
||||||
ver = container.opf_version_parsed
|
ver = container.opf_version_parsed
|
||||||
|
mm = container.mime_map
|
||||||
if ver.major < 3:
|
if ver.major < 3:
|
||||||
mm = container.mime_map
|
|
||||||
guide_type_map = container.guide_type_map
|
guide_type_map = container.guide_type_map
|
||||||
for ref_type, name in guide_type_map.iteritems():
|
for ref_type, name in guide_type_map.iteritems():
|
||||||
if ref_type.lower() == 'cover' and mm.get(name, '').lower() in OEB_DOCS:
|
if ref_type.lower() == 'cover' and mm.get(name, '').lower() in OEB_DOCS:
|
||||||
@ -263,6 +263,10 @@ def find_cover_page(container):
|
|||||||
else:
|
else:
|
||||||
for name in container.manifest_items_with_property('calibre:title-page'):
|
for name in container.manifest_items_with_property('calibre:title-page'):
|
||||||
return name
|
return name
|
||||||
|
from calibre.ebooks.oeb.polish.toc import get_landmarks
|
||||||
|
for landmark in get_landmarks(container):
|
||||||
|
if landmark['type'] == 'cover' and mm.get(landmark['dest'], '').lower() in OEB_DOCS:
|
||||||
|
return landmark['dest']
|
||||||
|
|
||||||
|
|
||||||
def find_cover_image_in_page(container, cover_page):
|
def find_cover_image_in_page(container, cover_page):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user