EPUB Input: When there are multiple elements of the same type in the OPF guide, use the first rather than the last element.

This commit is contained in:
Kovid Goyal 2012-06-28 19:27:46 +05:30
parent 5f122fd712
commit 484d58baa3

View File

@ -347,7 +347,9 @@ class OEBReader(object):
self.logger.warn(u'Guide reference %r not found' % href) self.logger.warn(u'Guide reference %r not found' % href)
continue continue
href = corrected_href href = corrected_href
guide.add(elem.get('type'), elem.get('title'), href) typ = elem.get('type')
if typ not in guide:
guide.add(typ, elem.get('title'), href)
def _find_ncx(self, opf): def _find_ncx(self, opf):
result = xpath(opf, '/o2:package/o2:spine/@toc') result = xpath(opf, '/o2:package/o2:spine/@toc')