Fix problem triggered by unconditional toctree call and empty toctree

Refs rtfd/readthedocs.org#2398
This commit is contained in:
Anthony Johnson 2017-03-06 10:03:33 -08:00
parent 82484eb5b5
commit 0af470f7cf
No known key found for this signature in database
GPG Key ID: C5C79D82F922D604

View File

@ -125,12 +125,18 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
{% block menu %}
{% set toctree = toctree(maxdepth=theme_navigation_depth|int, collapse=theme_collapse_navigation, includehidden=True) %}
{% if toctree %}
{{ toctree }}
{#
The singlehtml builder doesn't handle this toctree call when the
toctree is empty. Skip building this for now.
#}
{% if builder != 'singlehtml' %}
{% set global_toc = toctree(maxdepth=theme_navigation_depth|int, collapse=theme_collapse_navigation, includehidden=True) %}
{% endif %}
{% if global_toc %}
{{ global_toc }}
{% else %}
<!-- Local TOC -->
<div class="local-toc">{{ toc }}</div>
<!-- Local TOC -->
<div class="local-toc">{{ toc }}</div>
{% endif %}
{% endblock %}
</div>