mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix TOC is not shown when no `:maxdepth:` for toctrees (ref: #771)
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -16,6 +16,7 @@ Bugs fixed
|
|||||||
* #2211: Fix paragraphs in table cell doesn't work in Latex output
|
* #2211: Fix paragraphs in table cell doesn't work in Latex output
|
||||||
* #2253: ``:pyobject:`` option of ``literalinclude`` directive can't detect indented
|
* #2253: ``:pyobject:`` option of ``literalinclude`` directive can't detect indented
|
||||||
body block when the block starts with blank or comment lines.
|
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)
|
Release 1.3.4 (released Jan 12, 2016)
|
||||||
=====================================
|
=====================================
|
||||||
|
|||||||
@@ -97,8 +97,8 @@ class LaTeXBuilder(Builder):
|
|||||||
self.info("processing " + targetname + "... ", nonl=1)
|
self.info("processing " + targetname + "... ", nonl=1)
|
||||||
toctrees = self.env.get_doctree(docname).traverse(addnodes.toctree)
|
toctrees = self.env.get_doctree(docname).traverse(addnodes.toctree)
|
||||||
if toctrees:
|
if toctrees:
|
||||||
if toctrees[0].get('maxdepth'):
|
if toctrees[0].get('maxdepth') > 0:
|
||||||
tocdepth = int(toctrees[0].get('maxdepth'))
|
tocdepth = toctrees[0].get('maxdepth')
|
||||||
else:
|
else:
|
||||||
tocdepth = None
|
tocdepth = None
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -474,3 +474,25 @@ def test_toctree_maxdepth_howto(app, status, warning):
|
|||||||
print(status.getvalue())
|
print(status.getvalue())
|
||||||
print(warning.getvalue())
|
print(warning.getvalue())
|
||||||
assert '\\setcounter{tocdepth}{2}' in result
|
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