Sphinx:可以结合 rst-class 和 .. ifconfig?
Sphinx: Possible to combine rst-class and .. ifconfig?
我正在编写软件文档。我正在使用 .. rst-cass::
指令将特定的 css 类 添加到控制不同样式和功能的不同部分,效果非常好。现在我尝试创建不同版本的文档,因此尝试将 .. rst-cass::
与 .. ifconfig::
结合起来。我的第一个文件看起来像这样:
.. ifconfig:: var==True
.. rst-class:: html-toggle
.. ifconfig:: var==False
.. rst-class:: grey
Sectiontitle
============
当我尝试将其构建到 HTML 文件中时,构建过程没有完成并向我显示:
'Losing "%s" attribute: %s' % (att, self[att])
AssertionError: Losing "classes" attribute: ['html-toggle']
有什么方法可以工作,或者任何其他方法,根据 conf.py
中的变量将 css 类 分配给部分
提前致谢:)
使用自定义 CSS,而不是将 类 添加到 HTML,并使用 conf.py
选择要在 conf.py
中使用的样式 sheet =20=]表达式。
ifconfig
is intended to"include content of the directive only if the Python expression given as an argument is True",不是自定义样式。
我正在编写软件文档。我正在使用 .. rst-cass::
指令将特定的 css 类 添加到控制不同样式和功能的不同部分,效果非常好。现在我尝试创建不同版本的文档,因此尝试将 .. rst-cass::
与 .. ifconfig::
结合起来。我的第一个文件看起来像这样:
.. ifconfig:: var==True
.. rst-class:: html-toggle
.. ifconfig:: var==False
.. rst-class:: grey
Sectiontitle
============
当我尝试将其构建到 HTML 文件中时,构建过程没有完成并向我显示:
'Losing "%s" attribute: %s' % (att, self[att])
AssertionError: Losing "classes" attribute: ['html-toggle']
有什么方法可以工作,或者任何其他方法,根据 conf.py
中的变量将 css 类 分配给部分提前致谢:)
使用自定义 CSS,而不是将 类 添加到 HTML,并使用 conf.py
选择要在 conf.py
中使用的样式 sheet =20=]表达式。
ifconfig
is intended to"include content of the directive only if the Python expression given as an argument is True",不是自定义样式。