mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fixes #1690: toctrees with `glob
` option now can also contain entries for single documents with explicit title.
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -21,6 +21,8 @@ Bugs fixed
|
||||
* On windows, make-mode didn't work on Win32 platform if sphinx was invoked as
|
||||
``python sphinx-build.py``.
|
||||
* #1687: linkcheck now treats 401 Unauthorized responses as "working".
|
||||
* #1690: toctrees with ``glob`` option now can also contain entries for single
|
||||
documents with explicit title.
|
||||
|
||||
|
||||
Release 1.3b2 (released Dec 5, 2014)
|
||||
|
@@ -62,7 +62,18 @@ class TocTree(Directive):
|
||||
for entry in self.content:
|
||||
if not entry:
|
||||
continue
|
||||
if not glob:
|
||||
if glob and ('*' in entry or '?' in entry or '[' in entry):
|
||||
patname = docname_join(env.docname, entry)
|
||||
docnames = sorted(patfilter(all_docnames, patname))
|
||||
for docname in docnames:
|
||||
all_docnames.remove(docname) # don't include it again
|
||||
entries.append((None, docname))
|
||||
includefiles.append(docname)
|
||||
if not docnames:
|
||||
ret.append(self.state.document.reporter.warning(
|
||||
'toctree glob pattern %r didn\'t match any documents'
|
||||
% entry, line=self.lineno))
|
||||
else:
|
||||
# look for explicit titles ("Some Title <document>")
|
||||
m = explicit_title_re.match(entry)
|
||||
if m:
|
||||
@@ -85,19 +96,9 @@ class TocTree(Directive):
|
||||
'document %r' % docname, line=self.lineno))
|
||||
env.note_reread()
|
||||
else:
|
||||
all_docnames.remove(docname)
|
||||
entries.append((title, docname))
|
||||
includefiles.append(docname)
|
||||
else:
|
||||
patname = docname_join(env.docname, entry)
|
||||
docnames = sorted(patfilter(all_docnames, patname))
|
||||
for docname in docnames:
|
||||
all_docnames.remove(docname) # don't include it again
|
||||
entries.append((None, docname))
|
||||
includefiles.append(docname)
|
||||
if not docnames:
|
||||
ret.append(self.state.document.reporter.warning(
|
||||
'toctree glob pattern %r didn\'t match any documents'
|
||||
% entry, line=self.lineno))
|
||||
subnode = addnodes.toctree()
|
||||
subnode['parent'] = env.docname
|
||||
# entries contains all entries (self references, external links etc.)
|
||||
|
Reference in New Issue
Block a user