警告:文档不包含在包含文件的任何目录树中

编程入门 行业动态 更新时间:2024-10-25 11:18:52
本文介绍了警告:文档不包含在包含文件的任何目录树中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我收到警告:

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.

更多推荐

警告:文档不包含在包含文件的任何目录树中

本文发布于:2023-11-16 09:49:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1603184.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不包含   文档   文件   目录

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!