Ignore entries without an anchor

This commit is contained in:
Kovid Goyal 2020-08-31 07:59:28 +05:30
parent bc634e02bd
commit bfa1fbba6f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1527,9 +1527,14 @@ class BasicNewsRecipe(Recipe):
play_order=po, author=auth, play_order=po, author=auth,
description=desc, toc_thumbnail=tt) description=desc, toc_thumbnail=tt)
for entry in a.internal_toc_entries: for entry in a.internal_toc_entries:
anchor = entry.get('anchor')
if anchor:
self.play_order_counter += 1 self.play_order_counter += 1
po += 1 po += 1
article_toc_entry.add_item(arelpath, entry['anchor'], entry['title'], play_order=po) article_toc_entry.add_item(
arelpath, entry['anchor'], entry['title'] or _('Unknown section'),
play_order=po
)
last = os.path.join(self.output_dir, ('%sindex.html'%adir).replace('/', os.sep)) last = os.path.join(self.output_dir, ('%sindex.html'%adir).replace('/', os.sep))
for sp in a.sub_pages: for sp in a.sub_pages:
prefix = os.path.commonprefix([opf_path, sp]) prefix = os.path.commonprefix([opf_path, sp])