Skip to content

Commit

Permalink
Revert "Fix problem triggered by unconditional toctree call and empty…
Browse files Browse the repository at this point in the history
… toctree" (#507)

Fixes #374
  • Loading branch information
Blendify authored Mar 11, 2021
1 parent 894aef5 commit de76c03
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
18 changes: 6 additions & 12 deletions sphinx_rtd_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,12 @@
{%- block navigation %}
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="{{ _('Main') }}">
{%- block menu %}
{#-
The singlehtml builder doesn't handle this toctree call when the
toctree is empty. Skip building this for now.
#}
{%- if 'singlehtml' not in builder %}
{%- set global_toc = toctree(maxdepth=theme_navigation_depth|int,
collapse=theme_collapse_navigation|tobool,
includehidden=theme_includehidden|tobool,
titles_only=theme_titles_only|tobool) %}
{%- endif %}
{%- if global_toc %}
{{ global_toc }}
{%- set toctree = toctree(maxdepth=theme_navigation_depth|int,
collapse=theme_collapse_navigation|tobool,
includehidden=theme_includehidden|tobool,
titles_only=theme_titles_only|tobool) %}
{%- if toctree %}
{{ toctree }}
{%- else %}
<!-- Local TOC -->
<div class="local-toc">{{ toc }}</div>
Expand Down
5 changes: 1 addition & 4 deletions tests/test_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,9 @@ def test_basic():
assert search in content
elif isinstance(app.builder, SingleFileHTMLBuilder):
search = (
'<div class="local-toc"><ul>\n'
'<ul>\n'
'<li class="toctree-l1">'
'<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'
'</ul>'
)
Expand Down

0 comments on commit de76c03

Please sign in to comment.