This commit is contained in:
Kovid Goyal 2012-05-04 08:32:41 +05:30
parent 986dea628b
commit ca03d35d85

View File

@ -156,7 +156,8 @@ class CHMReader(CHMFile):
break break
if self.hhc_path not in files and files: if self.hhc_path not in files and files:
for f in files: for f in files:
if f.partition('.')[-1].lower() in {'html', 'htm'}: if f.partition('.')[-1].lower() in {'html', 'htm', 'xhtm',
'xhtml'}:
self.hhc_path = f self.hhc_path = f
break break
@ -168,6 +169,9 @@ class CHMReader(CHMFile):
self.hhc_path = os.path.relpath(x, output_dir) self.hhc_path = os.path.relpath(x, output_dir)
break break
if self.hhc_path not in files and files:
self.hhc_path = files[0]
def _reformat(self, data, htmlpath): def _reformat(self, data, htmlpath):
if self.input_encoding: if self.input_encoding:
data = data.decode(self.input_encoding) data = data.decode(self.input_encoding)