This commit is contained in:
Kovid Goyal 2008-07-02 06:28:54 -07:00
parent a59c1a87bc
commit 61c29df9d7

View File

@ -176,8 +176,11 @@ class MobiReader(object):
for elem in soup.findAll(['metadata', 'guide']): for elem in soup.findAll(['metadata', 'guide']):
elem.extract() elem.extract()
htmlfile = os.path.join(output_dir, self.name+'.html') htmlfile = os.path.join(output_dir, self.name+'.html')
try:
for ref in guide.findAll('reference', href=True): for ref in guide.findAll('reference', href=True):
ref['href'] = os.path.basename(htmlfile)+ref['href'] ref['href'] = os.path.basename(htmlfile)+ref['href']
except AttributeError:
pass
open(htmlfile, 'wb').write(unicode(soup).encode('utf8')) open(htmlfile, 'wb').write(unicode(soup).encode('utf8'))
self.htmlfile = htmlfile self.htmlfile = htmlfile