mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
EPUB Input: Do no skip the valid children of an NCX node that has no text/href
This commit is contained in:
parent
7aa4f83fed
commit
bf3913b791
@ -363,12 +363,23 @@ class OEBReader(object):
|
|||||||
title = ''.join(xpath(child, 'ncx:navLabel/ncx:text/text()'))
|
title = ''.join(xpath(child, 'ncx:navLabel/ncx:text/text()'))
|
||||||
title = COLLAPSE_RE.sub(' ', title.strip())
|
title = COLLAPSE_RE.sub(' ', title.strip())
|
||||||
href = xpath(child, 'ncx:content/@src')
|
href = xpath(child, 'ncx:content/@src')
|
||||||
if not title or not href:
|
if not title:
|
||||||
|
self._toc_from_navpoint(item, toc, child)
|
||||||
continue
|
continue
|
||||||
|
if not href:
|
||||||
|
gc = xpath(child, 'ncx:navPoint')
|
||||||
|
if not gc:
|
||||||
|
# This node is useless
|
||||||
|
continue
|
||||||
|
href = 'missing.html'
|
||||||
|
|
||||||
href = item.abshref(urlnormalize(href[0]))
|
href = item.abshref(urlnormalize(href[0]))
|
||||||
path, _ = urldefrag(href)
|
path, _ = urldefrag(href)
|
||||||
if path not in self.oeb.manifest.hrefs:
|
if 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')
|
||||||
|
if not gc:
|
||||||
|
# This node is useless
|
||||||
continue
|
continue
|
||||||
id = child.get('id')
|
id = child.get('id')
|
||||||
klass = child.get('class', 'chapter')
|
klass = child.get('class', 'chapter')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user