parent
ef6bfa9046
commit
560a2306dc
|
@ -141,7 +141,10 @@ class EPUB(zipfile.ZipFile):
|
||||||
raise InvalidEpub("Cannot process an EPUB without unique-identifier attribute of the package element")
|
raise InvalidEpub("Cannot process an EPUB without unique-identifier attribute of the package element")
|
||||||
# Get and parse the TOC
|
# Get and parse the TOC
|
||||||
toc_id = self.opf[2].get("toc")
|
toc_id = self.opf[2].get("toc")
|
||||||
expr = ".//{0}item[@id='{1:s}']".format(NAMESPACE["opf"], toc_id)
|
if toc_id:
|
||||||
|
expr = ".//{0}item[@id='{1:s}']".format(NAMESPACE["opf"], toc_id)
|
||||||
|
else:
|
||||||
|
expr = ".//{0}item[@properties='nav']".format(NAMESPACE["opf"])
|
||||||
toc_name = self.opf.find(expr).get("href")
|
toc_name = self.opf.find(expr).get("href")
|
||||||
self.ncx_path = os.path.join(self.root_folder, toc_name)
|
self.ncx_path = os.path.join(self.root_folder, toc_name)
|
||||||
self.ncx = ET.fromstring(self.read(self.ncx_path))
|
self.ncx = ET.fromstring(self.read(self.ncx_path))
|
||||||
|
|
Loading…
Reference in New Issue