From a6ef8f7efd5dc8ac1ab3c9d76bbeb67cd2335f10 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 22 Aug 2018 13:12:51 +0530 Subject: [PATCH] ToC editor: Fix generating toc entries from links not working for links that start with # --- src/calibre/ebooks/oeb/polish/toc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/polish/toc.py b/src/calibre/ebooks/oeb/polish/toc.py index d6a6fadb04..5546481892 100644 --- a/src/calibre/ebooks/oeb/polish/toc.py +++ b/src/calibre/ebooks/oeb/polish/toc.py @@ -468,7 +468,10 @@ def from_links(container): href = a.get('href') if not href or not href.strip(): continue - dest = container.href_to_name(href, base=name) + if href.startswith('#'): + dest = name + else: + dest = container.href_to_name(href, base=name) frag = href.rpartition('#')[-1] or None if (dest, frag) in seen_dests: continue