Conversion pipeline: Handle guide elements with incorrectly cased hrefs. Also handle guide elements of type coverimagestandard and thumbimagestandard.

This commit is contained in:
Kovid Goyal 2012-06-06 10:55:35 +05:30
parent a3a984386a
commit 47896643ae
2 changed files with 11 additions and 4 deletions

View File

@ -338,8 +338,15 @@ class OEBReader(object):
href = elem.get('href')
path = urlnormalize(urldefrag(href)[0])
if path not in manifest.hrefs:
self.logger.warn(u'Guide reference %r not found' % href)
continue
corrected_href = None
for href in manifest.hrefs:
if href.lower() == path.lower():
corrected_href = href
break
if corrected_href is None:
self.logger.warn(u'Guide reference %r not found' % href)
continue
href = corrected_href
guide.add(elem.get('type'), elem.get('title'), href)
def _find_ncx(self, opf):

View File

@ -15,10 +15,10 @@ class Clean(object):
if 'cover' not in self.oeb.guide:
covers = []
for x in ('other.ms-coverimage-standard',
for x in ('other.ms-coverimage-standard', 'coverimagestandard',
'other.ms-titleimage-standard', 'other.ms-titleimage',
'other.ms-coverimage', 'other.ms-thumbimage-standard',
'other.ms-thumbimage'):
'other.ms-thumbimage', 'thumbimagestandard'):
if x in self.oeb.guide:
href = self.oeb.guide[x].href
item = self.oeb.manifest.hrefs[href]