mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Conversion: Preserve ToC entries that point nowhere instead of causing them to point to a non-existant file
This commit is contained in:
parent
805d8c6223
commit
67e691c2ff
@ -373,16 +373,12 @@ class OEBReader(object):
|
|||||||
if not title:
|
if not title:
|
||||||
self._toc_from_navpoint(item, toc, child)
|
self._toc_from_navpoint(item, toc, child)
|
||||||
continue
|
continue
|
||||||
if not href:
|
if (not href or not href[0]) and not xpath(child, 'ncx:navPoint'):
|
||||||
gc = xpath(child, 'ncx:navPoint')
|
# This node is useless
|
||||||
if not gc:
|
continue
|
||||||
# This node is useless
|
href = item.abshref(urlnormalize(href[0])) if href and href[0] else ''
|
||||||
continue
|
|
||||||
href = 'missing.html'
|
|
||||||
|
|
||||||
href = item.abshref(urlnormalize(href[0]))
|
|
||||||
path, _ = urldefrag(href)
|
path, _ = urldefrag(href)
|
||||||
if path not in self.oeb.manifest.hrefs:
|
if href and path not in self.oeb.manifest.hrefs:
|
||||||
self.logger.warn('TOC reference %r not found' % href)
|
self.logger.warn('TOC reference %r not found' % href)
|
||||||
gc = xpath(child, 'ncx:navPoint')
|
gc = xpath(child, 'ncx:navPoint')
|
||||||
if not gc:
|
if not gc:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user