有一个ifconfig
sphinx扩展——它允许有条件地包含内容。我在寻找一种有条件地包含扩展的方法。我的最佳尝试是给-D
选项的扩展列表sphinx-build
:
sphinx-build -b singlehtml -d _build/doctrees -D html_theme=empty -D "extensions=['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.numfig', 'sphinx.ext.ifconfig', 'cloud_sptheme.ext.table_styling', 'sphinx.ext.htmlmath']" . _build/wkA
但它不起作用。在
问题是有条件地包含sphinx.ext.htmlmath
或{
conf.py
是一个python模块,extensions
是一个列表,因此您只需根据一个条件将扩展附加到extensions
中:但是,您必须在生成过程开始之前了解您的条件。在
使用
-t <tag>
http://sphinx-doc.org/invocation.html#cmdoption-sphinx-build-t例如,像这样调用sphinx(参见
-t use_htmlmath
):将此代码保存在
^{pr2}$conf.py
相关问题 更多 >
编程相关推荐