mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Redece tocdepth if part
or chapter
is used for top_sectionlevel (ref #2358)
This commit is contained in:
parent
119b971804
commit
e81f7186e8
1
CHANGES
1
CHANGES
@ -31,6 +31,7 @@ Bugs fixed
|
||||
* #2329: Refresh environment forcely if source directory has changed.
|
||||
* #2019: Fix the domain objects in search result are not escaped
|
||||
* #2358: Fix user-preamble could not override the tocdepth definition.
|
||||
* #2358: Redece tocdepth if ``part`` or ``chapter`` is used for top_sectionlevel.
|
||||
|
||||
Release 1.3.5 (released Jan 24, 2016)
|
||||
=====================================
|
||||
|
@ -293,6 +293,15 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
self.builder = builder
|
||||
self.body = []
|
||||
|
||||
# determine top section level
|
||||
if document.settings.docclass == 'howto':
|
||||
self.top_sectionlevel = 2
|
||||
else:
|
||||
if builder.config.latex_use_parts:
|
||||
self.top_sectionlevel = 0
|
||||
else:
|
||||
self.top_sectionlevel = 1
|
||||
|
||||
# sort out some elements
|
||||
papersize = builder.config.latex_paper_size + 'paper'
|
||||
if papersize == 'paper': # e.g. command line "-D latex_paper_size="
|
||||
@ -363,12 +372,14 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
self.elements['classoptions'] += ',' + \
|
||||
self.elements['extraclassoptions']
|
||||
if document.get('tocdepth'):
|
||||
if document.settings.docclass == 'howto':
|
||||
self.elements['tocdepth'] = ('\\setcounter{tocdepth}{%d}' %
|
||||
document['tocdepth'])
|
||||
else:
|
||||
self.elements['tocdepth'] = ('\\setcounter{tocdepth}{%d}' %
|
||||
(document['tocdepth'] - 1))
|
||||
# redece tocdepth if `part` or `chapter` is used for top_sectionlevel
|
||||
# tocdepth = -1: show only parts
|
||||
# tocdepth = 0: show parts and chapters
|
||||
# tocdepth = 1: show parts, chapters and sections
|
||||
# tocdepth = 2: show parts, chapters, sections and subsections
|
||||
# ...
|
||||
self.elements['tocdepth'] = ('\\setcounter{tocdepth}{%d}' %
|
||||
(document['tocdepth'] + self.top_sectionlevel - 2))
|
||||
if getattr(document.settings, 'contentsname', None):
|
||||
self.elements['contentsname'] = \
|
||||
self.babel_renewcommand(builder, '\\contentsname',
|
||||
@ -395,13 +406,6 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
self.pending_footnotes = []
|
||||
self.curfilestack = []
|
||||
self.handled_abbrs = set()
|
||||
if document.settings.docclass == 'howto':
|
||||
self.top_sectionlevel = 2
|
||||
else:
|
||||
if builder.config.latex_use_parts:
|
||||
self.top_sectionlevel = 0
|
||||
else:
|
||||
self.top_sectionlevel = 1
|
||||
self.next_section_ids = set()
|
||||
self.next_figure_ids = set()
|
||||
self.next_table_ids = set()
|
||||
|
Loading…
Reference in New Issue
Block a user