mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-30 11:15:37 +01:00
TXT Output: Fix inline toc not showing all items.
This commit is contained in:
parent
ed2b94ac9d
commit
deee20d8f8
1 changed files with 4 additions and 2 deletions
|
|
@ -55,6 +55,7 @@ def extract_content(self, oeb_book, opts):
|
|||
self.log.info('Converting XHTML to TXT...')
|
||||
self.oeb_book = oeb_book
|
||||
self.opts = opts
|
||||
self.toc_titles = []
|
||||
self.toc_ids = []
|
||||
self.last_was_heading = False
|
||||
|
||||
|
|
@ -94,8 +95,8 @@ def get_toc(self):
|
|||
if getattr(self.opts, 'inline_toc', None):
|
||||
self.log.debug('Generating table of contents...')
|
||||
toc.append(u'%s\n\n' % _(u'Table of Contents:'))
|
||||
for item in self.oeb_book.toc:
|
||||
toc.append(u'* %s\n\n' % item.title)
|
||||
for item in self.toc_titles:
|
||||
toc.append(u'* %s\n\n' % item)
|
||||
return ''.join(toc)
|
||||
|
||||
def create_flat_toc(self, nodes):
|
||||
|
|
@ -103,6 +104,7 @@ def create_flat_toc(self, nodes):
|
|||
Turns a hierarchical list of TOC href's into a flat list.
|
||||
'''
|
||||
for item in nodes:
|
||||
self.toc_titles.append(item.title)
|
||||
self.toc_ids.append(item.href)
|
||||
self.create_flat_toc(item.nodes)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue