1

I have a class with a large number of attributes; I would like to present them grouped (rather than in a flat list), with a section-like appearance inside the class documentation.

Is this possible with docutils/sphinx? Any suggestion to achieve something visually similar, perhaps by inserting dummy attributes?

4

1 回答 1

1

常规的 reST 部分标题不起作用(请参阅这个相当近期的邮件列表线程,以及这个较旧的线程),但该.. rubric::指令可以用作文档字符串中的标题。也许你可以使用这样的东西:

class MyClass(object):
    """
    .. rubric:: Class variables 

    :cvar foo: foo documentation
    :cvar bar: bar documentation

    .. rubric:: Instance variables

    :ivar baz: baz documentation

    """

    pass
于 2013-07-09T12:56:32.407 回答