rename name option for toctree directive to caption.

This commit is contained in:
shimizukawa
2015-03-08 15:09:07 +09:00
parent c5e0910958
commit 31400de378
2 changed files with 6 additions and 6 deletions

View File

@@ -40,7 +40,7 @@ class TocTree(Directive):
final_argument_whitespace = False
option_spec = {
'maxdepth': int,
'name': str,
'caption': str,
'glob': directives.flag,
'hidden': directives.flag,
'includehidden': directives.flag,
@@ -52,7 +52,7 @@ class TocTree(Directive):
env = self.state.document.settings.env
suffixes = env.config.source_suffix
glob = 'glob' in self.options
name = self.options.get('name')
caption = self.options.get('caption')
ret = []
# (title, ref) pairs, where ref may be a document, or an external link,
@@ -111,7 +111,7 @@ class TocTree(Directive):
# includefiles only entries that are documents
subnode['includefiles'] = includefiles
subnode['maxdepth'] = self.options.get('maxdepth', -1)
subnode['name'] = name
subnode['caption'] = caption
subnode['glob'] = glob
subnode['hidden'] = 'hidden' in self.options
subnode['includehidden'] = 'includehidden' in self.options

View File

@@ -1380,13 +1380,13 @@ class BuildEnvironment:
separate=False, subtree=False):
"""Return TOC entries for a toctree node."""
refs = [(e[0], e[1]) for e in toctreenode['entries']]
name = toctreenode.attributes.get('name')
caption = toctreenode.attributes.get('caption')
entries = []
if name:
if caption:
entries.extend(
nodes.reference('', '', internal=False,
refuri='', anchorname='',
*[nodes.Text(name)])
*[nodes.Text(caption)])
)
for (title, ref) in refs: