2

你如何修复狮身人面像在底部的警告?

我正在尝试将我的 Python 笔记放在 Sphinx 中。我将笔记放在与index.rst相同目录级别的单独文件中。

构建 HTML 后收到以下警告

警告

/home/heo/S_codes/trig_functions.rst:: WARNING: document isn't included in any toctree

构建时的完整信息

sudo sphinx-build -b html ./ _build/html
Running Sphinx v0.6.2
loading pickled environment... done
building [html]: targets for 0 source files that are out of date
updating environment: 1 added, 2 changed, 0 removed
reading sources... [100%] trig_functions
/home/heo/S_codes/databooklet.rst:1: (WARNING/2) malformed hyperlink target.
/home/heo/S_codes/index.rst:11: (ERROR/3) Error in "toctree" directive:
invalid option block.

.. toctree::
   :numbered:
   :glob:
   *
   databooklet.rst
   trig_functions.rst


/home/heo/S_codes/trig_functions.rst:11: (ERROR/3) Unexpected indentation.
looking for now-outdated files... none found
pickling environment... done
checking consistency... /home/heo/S_codes/databooklet.rst:: WARNING: document isn't included in any toctree
/home/heo/S_codes/trig_functions.rst:: WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [100%] trig_functions
writing additional files... genindex search
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded, 6 warnings.
4

1 回答 1

6

你知道 Sphinx 的文档吗? https://www.sphinx-doc.org

具体来说,阅读toctree指令:https ://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-toctree

您可以拥有任意数量的文件。通过toctree您可以从多个部分创建单个文档。


请实际阅读http ://sphinx.pocoo.org/concepts.html#document-names

由于 reST 源文件可以有不同的扩展名(有些人喜欢 .txt,有些人喜欢 .rst——扩展名可以用 source_suffix 配置)并且不同的操作系统有不同的路径分隔符,Sphinx 对它们进行抽象:所有“文档名称”都相对于源目录,扩展名被剥离,路径分隔符被转换为斜杠。所有引用“文档”的值、参数等都需要这样的文档名称。

文档名称的示例是indexlibrary/zipfilereference/datamodel/types。请注意,没有前导斜杠。

由于您使用 globbed *,因此您不需要列出您的文件。

如果您想列出您的文件,请实际阅读遵守上述规则。

于 2009-11-07T00:41:39.667 回答