Fix building with SingleHTMLBuilder when there is no toctree.

This commit is contained in:
Georg Brandl
2010-07-27 13:27:00 +02:00
parent 0aafe2ac1d
commit 8c0c728d1b
2 changed files with 11 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
Release 1.0.1 (in development)
==============================
* Fix building with SingleHTMLBuilder when there is no toctree.
* Fix display names for objects linked to by intersphinx with
explicit targets.

View File

@@ -847,8 +847,14 @@ class SingleFileHTMLBuilder(StandaloneHTMLBuilder):
def get_doc_context(self, docname, body, metatags):
# no relation links...
toc = self.env.get_toctree_for(self.config.master_doc, self, False)
self.fix_refuris(toc)
toc = self.render_partial(toc)['fragment']
# if there is no toctree, toc is None
if toc:
self.fix_refuris(toc)
toc = self.render_partial(toc)['fragment']
display_toc = True
else:
toc = ''
display_toc = False
return dict(
parents = [],
prev = None,
@@ -861,7 +867,7 @@ class SingleFileHTMLBuilder(StandaloneHTMLBuilder):
rellinks = [],
sourcename = '',
toc = toc,
display_toc = True,
display_toc = display_toc,
)
def write(self, *ignored):