mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
py domain: Support type annotations for variables
This adds ``:type:`` and ``:value:`` options to both ``py:data`` and ``py:attribute`` directives. It allows to describe its annotation in detail.
This commit is contained in:
@@ -195,6 +195,18 @@ The following directives are provided for module and class contents:
|
||||
as "defined constants." Class and object attributes are not documented
|
||||
using this environment.
|
||||
|
||||
.. rubric:: options
|
||||
|
||||
.. rst:directive:option:: type: type of the variable
|
||||
:type: text
|
||||
|
||||
.. versionadded:: 2.4
|
||||
|
||||
.. rst:directive:option:: value: initial value of the variable
|
||||
:type: text
|
||||
|
||||
.. versionadded:: 2.4
|
||||
|
||||
.. rst:directive:: .. py:exception:: name
|
||||
|
||||
Describes an exception class. The signature can, but need not include
|
||||
@@ -229,6 +241,18 @@ The following directives are provided for module and class contents:
|
||||
information about the type of the data to be expected and whether it may be
|
||||
changed directly.
|
||||
|
||||
.. rubric:: options
|
||||
|
||||
.. rst:directive:option:: type: type of the attribute
|
||||
:type: text
|
||||
|
||||
.. versionadded:: 2.4
|
||||
|
||||
.. rst:directive:option:: value: initial value of the attribute
|
||||
:type: text
|
||||
|
||||
.. versionadded:: 2.4
|
||||
|
||||
.. rst:directive:: .. py:method:: name(parameters)
|
||||
|
||||
Describes an object method. The parameters should not include the ``self``
|
||||
|
||||
Reference in New Issue
Block a user