Revert "Fix problem triggered by unconditional toctree call and empty toctree" (#507)

Fixes #374
This commit is contained in:
Aaron Carlisle 2021-03-11 09:59:21 -05:00 committed by GitHub
parent 894aef556e
commit de76c03824
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 16 deletions

View File

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

View File

@ -30,12 +30,9 @@ def test_basic():
assert search in content assert search in content
elif isinstance(app.builder, SingleFileHTMLBuilder): elif isinstance(app.builder, SingleFileHTMLBuilder):
search = ( search = (
'<div class="local-toc"><ul>\n' '<ul>\n'
'<li class="toctree-l1">' '<li class="toctree-l1">'
'<a class="reference internal" href="index.html#document-foo">foo</a>' '<a class="reference internal" href="index.html#document-foo">foo</a>'
'<ul>\n'
'<li class="toctree-l2">'
'<a class="reference internal" href="index.html#document-bar">bar</a>'
'</li>\n' '</li>\n'
'</ul>' '</ul>'
) )