diff options
| author | Georg Brandl <georg@python.org> | 2010-01-17 12:05:44 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2010-01-17 12:05:44 +0100 |
| commit | 7ea24199452928977f8468c0b608673d2341306d (patch) | |
| tree | 4eeea0420ad9c54a9d67118a8704a84697b91257 /sphinx/domains/python.py | |
| parent | 86879dd2f3c3ecc7007ca63121d2956db12c6d72 (diff) | |
| download | sphinx-7ea24199452928977f8468c0b608673d2341306d.tar.gz | |
Finish new doc field handling implementation.
Diffstat (limited to 'sphinx/domains/python.py')
| -rw-r--r-- | sphinx/domains/python.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index 3a1424ba..fca1d6fa 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -21,6 +21,7 @@ from sphinx.domains import Domain, ObjType from sphinx.directives import ObjectDescription from sphinx.util import make_refnode from sphinx.util.compat import Directive +from sphinx.util.docfields import Field, GroupedField, TypedField # REs for Python signatures @@ -40,6 +41,22 @@ class PyObject(ObjectDescription): Description of a general Python object. """ + doc_field_types = [ + TypedField('parameter', label=l_('Parameters'), + names=('param', 'parameter', 'arg', 'argument', + 'keyword', 'kwarg', 'kwparam'), + typerolename='obj', typenames=('type',)), + TypedField('variable', label=l_('Variables'), rolename='obj', + names=('var', 'ivar', 'cvar')), + GroupedField('exceptions', label=l_('Raises'), rolename='exc', + names=('raises', 'raise', 'exception', 'except'), + can_collapse=True), + Field('returnvalue', label=l_('Returns'), has_arg=False, + names=('returns', 'return')), + Field('returntype', label=l_('Return type'), has_arg=False, + names=('rtype',), rolename='obj'), + ] + def get_signature_prefix(self, sig): """ May return a prefix to put before the object name in the signature. |
