我刚使用Sphinx,想在两个不同的*.rst
文件中展示相同的图像。
第一个*.rst文件"lower.rst"
与"figures"文件夹处于同一级别,我可以像这样包含一个图像:
.. figure:: figures/figure1.png
第二个 * .rst 文件 "higher.rst" 比 "lower.rst" 高出几个级别。实际上,我是这样在 higher.rst 中包含 lower.rst 的:
.. include:: relative/path/to/lower.rst.
不幸的是,在higher.rst
中,来自lower.rst的图表未显示:
"image file not readable" error.
higher.rst
在当前目录中查找图像,而不是指向原始的低级目录。
这个问题在这里有所涉及: Can sphinx link to documents that are not located in directories below the root document?,但是我仍然不明白如何通过那里给出的信息解决我的问题。
source_suffix
中的一个值匹配。 你可以更改后缀(例如,my_included_file.inc
),或者将其添加到conf.py
中的exclude_patterns
中进行模式匹配。 - Steve Piercyexclude.*
所做的:exclude_patterns=[exclude.*]
,对吗?),但我想知道是否有更聪明的方法可以做到这一点?如果我同时排除*.rst
和*.inc
文件(这也是exclude.*
的作用,对吗?),那么它们都将无法为toctree所识别?或者我错了吗? - anfho