mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Closes #680: allow doc fields in cpp domain directives.
This commit is contained in:
parent
bdf5816437
commit
e5e44202b6
1
CHANGES
1
CHANGES
@ -36,6 +36,7 @@ Features added
|
||||
multiple terms per definition.
|
||||
- #478: Added :rst:dir:`py:decorator` directive to describe decorators.
|
||||
- C++ domain now supports array definitions.
|
||||
- C++ domain now supports doc fields (``:param x:`` inside directives).
|
||||
- Section headings in :rst:dir:`only` directives are now correctly
|
||||
handled.
|
||||
- Added ``emphasize-lines`` option to source code directives.
|
||||
|
@ -21,6 +21,7 @@ from sphinx.domains import Domain, ObjType
|
||||
from sphinx.directives import ObjectDescription
|
||||
from sphinx.util.nodes import make_refnode
|
||||
from sphinx.util.compat import Directive
|
||||
from sphinx.util.docfields import Field, GroupedField
|
||||
|
||||
|
||||
_identifier_re = re.compile(r'(~?\b[a-zA-Z_][a-zA-Z0-9_]*)\b')
|
||||
@ -838,6 +839,17 @@ class DefinitionParser(object):
|
||||
class CPPObject(ObjectDescription):
|
||||
"""Description of a C++ language object."""
|
||||
|
||||
doc_field_types = [
|
||||
GroupedField('parameter', label=l_('Parameters'),
|
||||
names=('param', 'parameter', 'arg', 'argument'),
|
||||
can_collapse=True),
|
||||
GroupedField('exceptions', label=l_('Throws'), rolename='cpp:class',
|
||||
names=('throws', 'throw', 'exception'),
|
||||
can_collapse=True),
|
||||
Field('returnvalue', label=l_('Returns'), has_arg=False,
|
||||
names=('returns', 'return')),
|
||||
]
|
||||
|
||||
def attach_name(self, node, name):
|
||||
owner, name = name.split_owner()
|
||||
varname = unicode(name)
|
||||
@ -1128,7 +1140,7 @@ class CPPDomain(Domain):
|
||||
node.line)
|
||||
return None
|
||||
|
||||
parent = node['cpp:parent']
|
||||
parent = node.get('cpp:parent', None)
|
||||
|
||||
rv = _create_refnode(expr)
|
||||
if rv is not None or parent is None:
|
||||
|
Loading…
Reference in New Issue
Block a user