我试图将Sphinx生成的类的文档中的 Attributes 表“上移”。我想在 Parameters 表之后找到该表,该表正是scikit-learn文档中的方式(例如,请参见此example)。
这是我的课程模板(class.rst
(非常受sphinx autosummary的class.rst启发):
:mod:`{{module}}`.{{objname}}
{{ underline }}==============
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}
{% block attributes %}
{% if attributes %}
.. rubric:: Attributes
.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block methods %}
{% if methods %}
.. rubric:: Methods
.. autosummary::
{% for item in methods %}
~{{ name }}.{{ item }}
{%- endfor %}
.. automethod:: __init__
{% endif %}
{% endblock %}
.. include:: {{module}}.{{objname}}.examples
.. raw:: html
<div class="clearer"></div>
我试图将Attributes块移到更高的位置,但是没有用。如果有人对如何实现有任何想法,将不胜感激。
非常感谢您。