【发布时间】:2011-01-14 00:05:50
【问题描述】:
我正在使用Sphinx 编写一些文档,并且我想打印出特定的文本块,仅用于 HTML 文档,而不是用于 LaTeX 文档。有些东西告诉我我应该可以用sphinx.ext.ifconfig 做到这一点,但我不知道怎么做。有谁知道怎么做?
【问题讨论】:
标签: python python-sphinx
我正在使用Sphinx 编写一些文档,并且我想打印出特定的文本块,仅用于 HTML 文档,而不是用于 LaTeX 文档。有些东西告诉我我应该可以用sphinx.ext.ifconfig 做到这一点,但我不知道怎么做。有谁知道怎么做?
【问题讨论】:
标签: python python-sphinx
不需要扩展。只需使用only 指令。
(旧链接,来自 2010 年的原始帖子)
https://web.archive.org/web/20100129001557/http://sphinx.pocoo.org/markup/misc.html#including-content-based-on-tags
它是这样工作的:
.. 只有:: 乳胶 这里的东西只出现在乳胶输出中。 .. 仅:: html 此块中的内容仅出现在 HTML 输出中。它是 将此指令与它一起使用通常很有用: .. 原始:: html 它适用于嵌入内容,例如视频。【讨论】:
singlehtml和html?
builder_html 和 builder_singlehtml 来区分 html 和 singlehtml。
only 上 Sphinx 文档的链接已失效。见:sphinx-doc.org/en/master/usage/restructuredtext/…