Skip to content

Commit

Permalink
Fix warning on not finding documents in toctree glob (#12720)
Browse files Browse the repository at this point in the history
  • Loading branch information
timhoffm authored Aug 11, 2024
1 parent be73e64 commit 6d3e5c7
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions sphinx/directives/other.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,20 @@ def parse_content(self, toctree: addnodes.toctree) -> None:
url_match = url_re.match(entry) is not None
if glob and glob_re.match(entry) and not explicit and not url_match:
pat_name = docname_join(current_docname, entry)
doc_names = sorted(patfilter(all_docnames, pat_name))
doc_names = sorted(
docname for docname in patfilter(all_docnames, pat_name)
# don't include generated documents in globs
if docname not in generated_docnames
)
if not doc_names:
logger.warning(
__("toctree glob pattern %r didn't match any documents"),
entry, location=toctree)

for docname in doc_names:
if docname in generated_docnames:
# don't include generated documents in globs
continue
all_docnames.remove(docname) # don't include it again
toctree['entries'].append((None, docname))
toctree['includefiles'].append(docname)
if not doc_names:
logger.warning(__("toctree glob pattern %r didn't match any documents"),
entry, location=toctree)
continue

if explicit:
Expand Down

0 comments on commit 6d3e5c7

Please sign in to comment.