3
我的手写文档/用户指南(用Sphinx编写在ReStructuredText中)已经变得相当大,所以我开始在子目录中组织我的.rst文件。如何在sphinx项目中正确包含其他ReST文件?
在index.rst
我包括每个子目录的subindex.rst
,其本身包括其他.rst
文件的其他子目录。
index.rst
:
.. include:: subdir1/subindex.rst
.. include:: subdir2/subindex.rst
subdir1/subindex.rst
:
.. include:: file1.rst
.. include:: file2.rst
原则上这个运作良好,除了那个狮身人面像递归寻找它试图解析.rst
-files。而无需更改当前工作目录。因此,在subdir1
内看到include:: file1.rst
时失败。
我正在通过设置exclude_pattern
来解决此问题,以忽略我的子目录。这似乎是不正确的。
什么是包含.rst
子文件的正确方法?
请阅读有关'toctree'指令的信息:http://www.sphinx-doc.org/en/stable/markup/toctree.html – Paebbels
如果您将subindex.rst中的include指令更改为' .. include ::/subdir1/file1.rst'和'.. include ::/subdir1/file2.rst'。 – mzjn