Fix #2576 (chm files) and handle empty TOCs in the conversion pipeline

This commit is contained in:
Kovid Goyal 2009-06-11 11:52:07 -07:00
parent 0b9f489e25
commit d596ed0341
2 changed files with 4 additions and 2 deletions

View File

@ -25,7 +25,7 @@ class DRMError(ValueError):
BOOK_EXTENSIONS = ['lrf', 'rar', 'zip', 'rtf', 'lit', 'txt', 'htm', 'xhtm', BOOK_EXTENSIONS = ['lrf', 'rar', 'zip', 'rtf', 'lit', 'txt', 'htm', 'xhtm',
'html', 'xhtml', 'pdf', 'pdb', 'prc', 'mobi', 'azw', 'doc', 'html', 'xhtml', 'pdf', 'pdb', 'prc', 'mobi', 'azw', 'doc',
'epub', 'fb2', 'djvu', 'lrx', 'cbr', 'cbz', 'oebzip', 'epub', 'fb2', 'djvu', 'lrx', 'cbr', 'cbz', 'oebzip',
'rb', 'imp', 'odt'] 'rb', 'imp', 'odt', 'chm']
class HTMLRenderer(object): class HTMLRenderer(object):

View File

@ -1327,7 +1327,9 @@ class TOC(object):
return len(list(self.iter())) - 1 return len(list(self.iter())) - 1
def next_play_order(self): def next_play_order(self):
return max([x.play_order for x in self.iter()])+1 entries = [x.play_order for x in self.iter()]
base = max(entries) if entries else 0
return base+1
def has_href(self, href): def has_href(self, href):
for x in self.iter(): for x in self.iter():