mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Closes #1489: Removes use of ":annotation:" for attribute types in napoleon, as inline markup is not allowed
This commit is contained in:
parent
fb2c15eaa7
commit
71b8fe8854
@ -324,7 +324,8 @@ enabled in `conf.py`::
|
|||||||
**If False**::
|
**If False**::
|
||||||
|
|
||||||
.. attribute:: attr1
|
.. attribute:: attr1
|
||||||
:annotation: int
|
|
||||||
|
*int*
|
||||||
|
|
||||||
Description of `attr1`
|
Description of `attr1`
|
||||||
|
|
||||||
|
@ -151,7 +151,8 @@ class Config(object):
|
|||||||
**If False**::
|
**If False**::
|
||||||
|
|
||||||
.. attribute:: attr1
|
.. attribute:: attr1
|
||||||
:annotation: int
|
|
||||||
|
*int*
|
||||||
|
|
||||||
Description of `attr1`
|
Description of `attr1`
|
||||||
|
|
||||||
|
@ -428,7 +428,11 @@ class GoogleDocstring(UnicodeMixin):
|
|||||||
else:
|
else:
|
||||||
lines.append('.. attribute:: ' + _name)
|
lines.append('.. attribute:: ' + _name)
|
||||||
if _type:
|
if _type:
|
||||||
lines.append(' :annotation: ' + _type)
|
lines.append('')
|
||||||
|
if '`' in _type:
|
||||||
|
lines.append(' %s' % _type)
|
||||||
|
else:
|
||||||
|
lines.append(' *%s*' % _type)
|
||||||
if _desc:
|
if _desc:
|
||||||
lines.extend([''] + self._indent(_desc, 3))
|
lines.extend([''] + self._indent(_desc, 3))
|
||||||
lines.append('')
|
lines.append('')
|
||||||
|
@ -205,6 +205,37 @@ This class should only be used by runtimes.
|
|||||||
"""
|
"""
|
||||||
self.assertEqual(expected, actual)
|
self.assertEqual(expected, actual)
|
||||||
|
|
||||||
|
def test_attributes_with_class_reference(self):
|
||||||
|
docstring = """\
|
||||||
|
Attributes:
|
||||||
|
in_attr(:class:`numpy.ndarray`): super-dooper attribute
|
||||||
|
"""
|
||||||
|
|
||||||
|
actual = str(GoogleDocstring(docstring))
|
||||||
|
expected = """\
|
||||||
|
.. attribute:: in_attr
|
||||||
|
|
||||||
|
:class:`numpy.ndarray`
|
||||||
|
|
||||||
|
super-dooper attribute
|
||||||
|
"""
|
||||||
|
self.assertEqual(expected, actual)
|
||||||
|
|
||||||
|
docstring = """\
|
||||||
|
Attributes:
|
||||||
|
in_attr(numpy.ndarray): super-dooper attribute
|
||||||
|
"""
|
||||||
|
|
||||||
|
actual = str(GoogleDocstring(docstring))
|
||||||
|
expected = """\
|
||||||
|
.. attribute:: in_attr
|
||||||
|
|
||||||
|
*numpy.ndarray*
|
||||||
|
|
||||||
|
super-dooper attribute
|
||||||
|
"""
|
||||||
|
self.assertEqual(expected, actual)
|
||||||
|
|
||||||
|
|
||||||
class NumpyDocstringTest(BaseDocstringTest):
|
class NumpyDocstringTest(BaseDocstringTest):
|
||||||
docstrings = [(
|
docstrings = [(
|
||||||
|
Loading…
Reference in New Issue
Block a user