Skip to content

Commit de76c03

Browse files
authored
Revert "Fix problem triggered by unconditional toctree call and empty toctree" (#507)
Fixes #374
1 parent 894aef5 commit de76c03

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

sphinx_rtd_theme/layout.html

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,12 @@
155155
{%- block navigation %}
156156
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="{{ _('Main') }}">
157157
{%- block menu %}
158-
{#-
159-
The singlehtml builder doesn't handle this toctree call when the
160-
toctree is empty. Skip building this for now.
161-
#}
162-
{%- if 'singlehtml' not in builder %}
163-
{%- set global_toc = toctree(maxdepth=theme_navigation_depth|int,
164-
collapse=theme_collapse_navigation|tobool,
165-
includehidden=theme_includehidden|tobool,
166-
titles_only=theme_titles_only|tobool) %}
167-
{%- endif %}
168-
{%- if global_toc %}
169-
{{ global_toc }}
158+
{%- set toctree = toctree(maxdepth=theme_navigation_depth|int,
159+
collapse=theme_collapse_navigation|tobool,
160+
includehidden=theme_includehidden|tobool,
161+
titles_only=theme_titles_only|tobool) %}
162+
{%- if toctree %}
163+
{{ toctree }}
170164
{%- else %}
171165
<!-- Local TOC -->
172166
<div class="local-toc">{{ toc }}</div>

tests/test_builders.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,9 @@ def test_basic():
3030
assert search in content
3131
elif isinstance(app.builder, SingleFileHTMLBuilder):
3232
search = (
33-
'<div class="local-toc"><ul>\n'
33+
'<ul>\n'
3434
'<li class="toctree-l1">'
3535
'<a class="reference internal" href="index.html#document-foo">foo</a>'
36-
'<ul>\n'
37-
'<li class="toctree-l2">'
38-
'<a class="reference internal" href="index.html#document-bar">bar</a>'
3936
'</li>\n'
4037
'</ul>'
4138
)

0 commit comments

Comments
 (0)