Dio*_*ult 6 python python-sphinx autosummary
我有一些 Sphinx 文档,如下所示:
Browse the code-based documentation here:
.. autosummary::
:toctree: _autosummary
:template: custom-module-template.rst
:recursive:
foo
Run Code Online (Sandbox Code Playgroud)
有、、等foo的模块在哪里?有办法排除吗?foo.barfoo.bar.afoo.bazfoo.baz
小智 2
在 custom-module-template.rst 模板上,在迭代子模块的部分,您可以添加 if 语句来检查模块的名称,如下所示:
{# rest of the module template #}
{% block modules %}
{% if modules %}
.. rubric:: Modules
.. autosummary::
:toctree:
:template: custom-module-template.rst
:recursive:
{% for item in modules %}
{% if not item.endswith('.baz') %}
{{ item }}
{%- endif %}
{%- endfor %}
{% endif %}
{% endblock %}
Run Code Online (Sandbox Code Playgroud)
我不确定这是最好的解决方案,但这对我有用。
自定义模块模板.rst的提示
| 归档时间: |
|
| 查看次数: |
619 次 |
| 最近记录: |