mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix: Combination of 'globaltoc.html' and hidden toctree cause exception. Closes #1157
This commit is contained in:
parent
1006011528
commit
59d655c435
1
CHANGES
1
CHANGES
@ -9,6 +9,7 @@ Features added
|
|||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
* #1157: Combination of 'globaltoc.html' and hidden toctree cause exception.
|
||||||
* Fix: 'make gettext' cause UnicodeDecodeError when templates contain utf-8
|
* Fix: 'make gettext' cause UnicodeDecodeError when templates contain utf-8
|
||||||
encoded string.
|
encoded string.
|
||||||
|
|
||||||
|
@ -1049,7 +1049,8 @@ class BuildEnvironment:
|
|||||||
for toctreenode in doctree.traverse(addnodes.toctree):
|
for toctreenode in doctree.traverse(addnodes.toctree):
|
||||||
toctree = self.resolve_toctree(docname, builder, toctreenode,
|
toctree = self.resolve_toctree(docname, builder, toctreenode,
|
||||||
prune=True, **kwds)
|
prune=True, **kwds)
|
||||||
toctrees.append(toctree)
|
if toctree:
|
||||||
|
toctrees.append(toctree)
|
||||||
if not toctrees:
|
if not toctrees:
|
||||||
return None
|
return None
|
||||||
result = toctrees[0]
|
result = toctrees[0]
|
||||||
|
@ -21,7 +21,7 @@ except ImportError:
|
|||||||
pygments = None
|
pygments = None
|
||||||
|
|
||||||
from sphinx import __version__
|
from sphinx import __version__
|
||||||
from util import test_root, remove_unicode_literals, gen_with_app
|
from util import test_root, remove_unicode_literals, gen_with_app, with_app
|
||||||
from etree13 import ElementTree as ET
|
from etree13 import ElementTree as ET
|
||||||
|
|
||||||
|
|
||||||
@ -344,3 +344,18 @@ def test_html(app):
|
|||||||
yield check_xpath, etree, fname, path, check
|
yield check_xpath, etree, fname, path, check
|
||||||
|
|
||||||
check_static_entries(app.builder.outdir)
|
check_static_entries(app.builder.outdir)
|
||||||
|
|
||||||
|
@with_app(buildername='html', srcdir='(empty)',
|
||||||
|
confoverrides={'html_sidebars': {'*': ['globaltoc.html']}},
|
||||||
|
)
|
||||||
|
def test_html_with_globaltoc_and_hidden_toctree(app):
|
||||||
|
# issue #1157: combination of 'globaltoc.html' and hidden toctree cause
|
||||||
|
# exception.
|
||||||
|
(app.srcdir / 'contents.rst').write_text(
|
||||||
|
'\n.. toctree::'
|
||||||
|
'\n'
|
||||||
|
'\n.. toctree::'
|
||||||
|
'\n :hidden:'
|
||||||
|
'\n')
|
||||||
|
app.builder.build_all()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user