MOBI Output: Fix ToC at start option having no effect when converting some input documents that have an out-of-spine ToC. Fixes #1033656 (Table of Contents not in Front after converting)

This commit is contained in:
Kovid Goyal 2012-08-07 10:41:48 +05:30
parent f0b673610a
commit 08f38df9b9

View File

@ -73,7 +73,10 @@ class HTMLTOCAdder(object):
if (hasattr(item.data, 'xpath') and if (hasattr(item.data, 'xpath') and
XPath('//h:a[@href]')(item.data)): XPath('//h:a[@href]')(item.data)):
if oeb.spine.index(item) < 0: if oeb.spine.index(item) < 0:
oeb.spine.add(item, linear=False) if self.position == 'end':
oeb.spine.add(item, linear=False)
else:
oeb.spine.insert(0, item, linear=True)
return return
elif has_toc: elif has_toc:
oeb.guide.remove('toc') oeb.guide.remove('toc')