Use document['tocdepth'] instead of document.setting.tocdepth

This commit is contained in:
Takeshi KOMIYA 2016-01-06 09:45:19 +09:00
parent acea9900b5
commit 924f65d737
2 changed files with 4 additions and 4 deletions

View File

@ -106,6 +106,7 @@ class LaTeXBuilder(Builder):
doctree = self.assemble_doctree(
docname, toctree_only,
appendices=((docclass != 'howto') and self.config.latex_appendices or []))
doctree['tocdepth'] = tocdepth
self.post_process_images(doctree)
self.info("writing... ", nonl=1)
doctree.settings = docsettings
@ -114,7 +115,6 @@ class LaTeXBuilder(Builder):
doctree.settings.contentsname = self.get_contentsname(docname)
doctree.settings.docname = docname
doctree.settings.docclass = docclass
doctree.settings.tocdepth = tocdepth
docwriter.write(doctree, destination)
self.info("done")

View File

@ -359,13 +359,13 @@ class LaTeXTranslator(nodes.NodeVisitor):
if self.elements['extraclassoptions']:
self.elements['classoptions'] += ',' + \
self.elements['extraclassoptions']
if document.settings.tocdepth:
if document.get('tocdepth'):
if document.settings.docclass == 'howto':
self.elements['tocdepth'] = ('\\setcounter{tocdepth}{%d}' %
document.settings.tocdepth)
document['tocdepth'])
else:
self.elements['tocdepth'] = ('\\setcounter{tocdepth}{%d}' %
(document.settings.tocdepth - 1))
(document['tocdepth'] - 1))
self.highlighter = highlighting.PygmentsBridge(
'latex',