diff --git a/sphinx/builders/epub.py b/sphinx/builders/epub.py index 74c328ea7..a5f7a84d0 100644 --- a/sphinx/builders/epub.py +++ b/sphinx/builders/epub.py @@ -198,7 +198,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): + if isinstance(doctree, nodes.reference) and hasattr(doctree, 'refuri'): refuri = doctree['refuri'] if refuri.startswith('http://') or refuri.startswith('https://') \ or refuri.startswith('irc:') or refuri.startswith('mailto:'):