Fix #3377 (--toc-filter only removes alternate entries)

This commit is contained in:
Kovid Goyal 2009-09-01 17:54:55 -06:00
parent 5f6c330901
commit 707f0ffa0c
2 changed files with 11 additions and 9 deletions

View File

@ -48,8 +48,10 @@ class DetectStructure(object):
if opts.toc_filter is not None:
regexp = re.compile(opts.toc_filter)
for node in self.oeb.toc.iter():
for node in list(self.oeb.toc.iter()):
if not node.title or regexp.search(node.title) is not None:
self.log('Filtering', node.title if node.title else\
'empty node', 'from TOC')
self.oeb.toc.remove(node)
if opts.page_breaks_before is not None: