mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-09-03 20:52:55 -05:00
Fix TOC is not shown when no `:maxdepth:` for toctrees (ref: #771)
This commit is contained in:
@@ -16,6 +16,7 @@ Bugs fixed
|
||||
* #2211: Fix paragraphs in table cell doesn't work in Latex output
|
||||
* #2253: ``:pyobject:`` option of ``literalinclude`` directive can't detect indented
|
||||
body block when the block starts with blank or comment lines.
|
||||
* Fix TOC is not shown when no ``:maxdepth:`` for toctrees (ref: #771)
|
||||
|
||||
Release 1.3.4 (released Jan 12, 2016)
|
||||
=====================================
|
||||
|
||||
@@ -97,8 +97,8 @@ class LaTeXBuilder(Builder):
|
||||
self.info("processing " + targetname + "... ", nonl=1)
|
||||
toctrees = self.env.get_doctree(docname).traverse(addnodes.toctree)
|
||||
if toctrees:
|
||||
if toctrees[0].get('maxdepth'):
|
||||
tocdepth = int(toctrees[0].get('maxdepth'))
|
||||
if toctrees[0].get('maxdepth') > 0:
|
||||
tocdepth = toctrees[0].get('maxdepth')
|
||||
else:
|
||||
tocdepth = None
|
||||
else:
|
||||
|
||||
@@ -474,3 +474,25 @@ def test_toctree_maxdepth_howto(app, status, warning):
|
||||
print(status.getvalue())
|
||||
print(warning.getvalue())
|
||||
assert '\\setcounter{tocdepth}{2}' in result
|
||||
|
||||
|
||||
@with_app(buildername='latex', testroot='toctree-maxdepth',
|
||||
confoverrides={'master_doc': 'foo'})
|
||||
def test_toctree_not_found(app, status, warning):
|
||||
app.builder.build_all()
|
||||
result = (app.outdir / 'Python.tex').text(encoding='utf8')
|
||||
print(result)
|
||||
print(status.getvalue())
|
||||
print(warning.getvalue())
|
||||
assert '\\setcounter{tocdepth}' not in result
|
||||
|
||||
|
||||
@with_app(buildername='latex', testroot='toctree-maxdepth',
|
||||
confoverrides={'master_doc': 'bar'})
|
||||
def test_toctree_without_maxdepth(app, status, warning):
|
||||
app.builder.build_all()
|
||||
result = (app.outdir / 'Python.tex').text(encoding='utf8')
|
||||
print(result)
|
||||
print(status.getvalue())
|
||||
print(warning.getvalue())
|
||||
assert '\\setcounter{tocdepth}' not in result
|
||||
|
||||
Reference in New Issue
Block a user