From 56a8b58046d7774fe1c8fdab12d853bcb927c84e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 23 Jun 2016 06:21:41 +0530 Subject: [PATCH] ToC Editor: Fix ToC detection in EPUB 3 files with only an NCX and no nav not working --- src/calibre/ebooks/oeb/polish/toc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/polish/toc.py b/src/calibre/ebooks/oeb/polish/toc.py index 75dd0dbc48..465c6821f0 100644 --- a/src/calibre/ebooks/oeb/polish/toc.py +++ b/src/calibre/ebooks/oeb/polish/toc.py @@ -256,7 +256,10 @@ def get_toc(container, verify_destinations=True): if ver.major < 3: return get_x_toc(container, find_existing_ncx_toc, parse_ncx, verify_destinations=verify_destinations) else: - return get_x_toc(container, find_existing_nav_toc, parse_nav, verify_destinations=verify_destinations) + ans = get_x_toc(container, find_existing_nav_toc, parse_nav, verify_destinations=verify_destinations) + if len(ans) == 0: + ans = get_x_toc(container, find_existing_ncx_toc, parse_ncx, verify_destinations=verify_destinations) + return ans def ensure_id(elem): if elem.tag == XHTML('a'):