警告:文档不包含在包含文件的任何目录树中 [英] WARNING: document isn't included in any toctree for included file
问题描述
我收到警告:
WARNING: document isn't included in any toctree
用于文档中存在的文件,因为它们已被明确包含.所以我有索引文件:
for files that exist in the document because they've been explicitly included. So I have the index file:
.. toctree::
:maxdepth: 2
pages/0010-foo
pages/0020-bar
在文件 0020-bar.rst 中,我特别包含了许多其他文件,例如:
In the file 0020-bar.rst, I'm specifically including a number of other files, as in:
.. contents:: :local:
.. include:: /pages/reference-architecture/technical-considerations/0070-baz.rst
但是当我构建项目时,我仍然收到警告 0070-baz.rst 不在任何目录树中,如下所示:
But when I build the project, I still get a warning that 0070-baz.rst isn't in any toctree, as in:
/home/nick/Documents/myProject/docs/pages/reference-architecture/technical-considerations/0070-baz.rst:: WARNING: document isn't included in any toctree
奇怪的是我可以在输出中看到内容.这是正常的吗?对于明确包含而不是通过 toctree 包含的文件,此警告是否总是出现?
The weird thing is that I can see the content in the output. Is this normal? Does this warning always appear for files that are explicitly included rather than included via toctree?
谢谢!
推荐答案
无论文件是否包含,Sphinx 都会抱怨这个问题.
Sphinx will complain about this whether the file is included or not.
但是,您可以使用 exclude_patterns 配置值.
However, you can specifically exclude files by using the exclude_patterns config value.
因此,对于您的情况,您可以尝试使用以下内容更改 Sphinx 的 conf.py
文件:
So for your case you might try to change Sphinx's conf.py
file with something like:
exclude_patterns = ['pages/reference-architecture', 'some/other/file.txt']
您可以通过这种方式排除单个文件、目录或使用文件通配模式来匹配文件组.
You can exclude individual files, directories, or use file globbing patterns to match groups of files this way.
请参阅:Joakim 的答案,了解在此答案之后添加的另一个选项已创建.
See: Joakim's answer for another option that was added after this answer was created.
这篇关于警告:文档不包含在包含文件的任何目录树中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!