From bfa1fbba6fd176d6bde51b3bcfc7316ec4ad814d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 31 Aug 2020 07:59:28 +0530 Subject: [PATCH] Ignore entries without an anchor --- src/calibre/web/feeds/news.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index 55681613e1..048f9cd4fb 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -1527,9 +1527,14 @@ class BasicNewsRecipe(Recipe): play_order=po, author=auth, description=desc, toc_thumbnail=tt) for entry in a.internal_toc_entries: - self.play_order_counter += 1 - po += 1 - article_toc_entry.add_item(arelpath, entry['anchor'], entry['title'], play_order=po) + anchor = entry.get('anchor') + if anchor: + self.play_order_counter += 1 + po += 1 + 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)) for sp in a.sub_pages: prefix = os.path.commonprefix([opf_path, sp])