Detect an NCX TOC which isn't mentioned by the /spine/@toc.

This commit is contained in:
Marshall T. Vandegrift 2008-12-18 22:51:25 -05:00
parent 9a30cdc3f2
commit 6550c18745

View File

@ -602,7 +602,10 @@ class OEBBook(object):
def _toc_from_ncx(self, opf): def _toc_from_ncx(self, opf):
result = xpath(opf, '/o2:package/o2:spine/@toc') result = xpath(opf, '/o2:package/o2:spine/@toc')
if not result: if not result:
return False expr = '/o2:package/o2:manifest/o2:item[@media-type="%s"]/@id'
result = xpath(opf, expr % NCX_MIME)
if len(result) != 1:
return False
id = result[0] id = result[0]
ncx = self.manifest[id].data ncx = self.manifest[id].data
self.manifest.remove(id) self.manifest.remove(id)