mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix toctree directive tries to glob for URL having query_string
This commit is contained in:
parent
32fe3a05e8
commit
ef10ca11fc
1
CHANGES
1
CHANGES
@ -29,6 +29,7 @@ Bugs fixed
|
||||
* #4837: latex with class memoir Error: Font command ``\sf`` is not supported
|
||||
* #4803: latex: too slow in proportion to number of auto numbered footnotes
|
||||
* #4838: htmlhelp: The entries in .hhp file is not ordered
|
||||
* toctree directive tries to glob for URL having query_string
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -99,7 +99,8 @@ class TocTree(Directive):
|
||||
continue
|
||||
# look for explicit titles ("Some Title <document>")
|
||||
explicit = explicit_title_re.match(entry)
|
||||
if toctree['glob'] and glob_re.match(entry) and not explicit:
|
||||
if (toctree['glob'] and glob_re.match(entry) and
|
||||
not explicit and not url_re.match(entry)):
|
||||
patname = docname_join(env.docname, entry)
|
||||
docnames = sorted(patfilter(all_docnames, patname))
|
||||
for docname in docnames:
|
||||
@ -139,7 +140,7 @@ class TocTree(Directive):
|
||||
|
||||
# entries contains all entries (self references, external links etc.)
|
||||
if 'reversed' in self.options:
|
||||
toctree['entries'] = toctree['entries'].reverse()
|
||||
toctree['entries'] = list(reversed(toctree['entries']))
|
||||
|
||||
return ret
|
||||
|
||||
|
@ -123,6 +123,21 @@ def test_toctree_glob(app):
|
||||
includefiles=['baz', 'foo', 'quux', 'foo'])
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='toctree-glob')
|
||||
def test_toctree_glob_and_url(app):
|
||||
text = (".. toctree::\n"
|
||||
" :glob:\n"
|
||||
"\n"
|
||||
" https://example.com/?q=sphinx\n")
|
||||
|
||||
app.env.find_files(app.config, app.builder)
|
||||
doctree = parse(app, 'index', text)
|
||||
assert_node(doctree, [nodes.document, nodes.compound, addnodes.toctree])
|
||||
assert_node(doctree[0][0],
|
||||
entries=[(None, 'https://example.com/?q=sphinx')],
|
||||
includefiles=[])
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='toctree-glob')
|
||||
def test_toctree_twice(app):
|
||||
text = (".. toctree::\n"
|
||||
|
Loading…
Reference in New Issue
Block a user