From 1ab2ea7ff0e6de25577e5dc302e7e86e8bc5d0a4 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 7 Mar 2018 15:11:28 +0900 Subject: [PATCH] epub: spine has been broken because of "self" in toctree --- CHANGES | 1 + sphinx/builders/_epub_base.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index cb4237ce9..d19a1beff 100644 --- a/CHANGES +++ b/CHANGES @@ -174,6 +174,7 @@ Bugs fixed * #5132: (lualatex) PDF build fails if indexed word starts with Unicode character * #5133: latex: index headings "Symbols" and "Numbers" not internationalized * #5114: sphinx-build: Handle errors on scanning documents +* epub: spine has been broken when "self" is listed on toctree (refs: #4611) Testing -------- diff --git a/sphinx/builders/_epub_base.py b/sphinx/builders/_epub_base.py index 2a975fa94..eaab43fda 100644 --- a/sphinx/builders/_epub_base.py +++ b/sphinx/builders/_epub_base.py @@ -195,7 +195,7 @@ class EpubBuilder(StandaloneHTMLBuilder): """Collect section titles, their depth in the toc and the refuri.""" # XXX: is there a better way than checking the attribute # toctree-l[1-8] on the parent node? - if isinstance(doctree, nodes.reference) and 'refuri' in doctree: + if isinstance(doctree, nodes.reference) and doctree.get('refuri'): refuri = doctree['refuri'] if refuri.startswith('http://') or refuri.startswith('https://') \ or refuri.startswith('irc:') or refuri.startswith('mailto:'):