diff options
| author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-06-14 11:48:44 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-14 11:48:44 +0900 |
| commit | 02acad66f09b5d14078ee17c2568d4d976d59a18 (patch) | |
| tree | aae28ba8817fbb85fccaf1904be448983e243050 /sphinx/ext | |
| parent | 6eb43ba13873019aa656a6b2d5efeb5deb32d6fb (diff) | |
| parent | e983189c942848033a52f0b92737f7f07ed6adbc (diff) | |
| download | sphinx-git-02acad66f09b5d14078ee17c2568d4d976d59a18.tar.gz | |
Merge pull request #7827 from tk0miya/7808_napoleon_nitpicky_warning
Revert "ext.napoleon: Emit type annotations at the start of `.. attribute::`"
Diffstat (limited to 'sphinx/ext')
| -rw-r--r-- | sphinx/ext/napoleon/__init__.py | 3 | ||||
| -rw-r--r-- | sphinx/ext/napoleon/docstring.py | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/sphinx/ext/napoleon/__init__.py b/sphinx/ext/napoleon/__init__.py index 9b41152fc..10b1ff3a3 100644 --- a/sphinx/ext/napoleon/__init__.py +++ b/sphinx/ext/napoleon/__init__.py @@ -168,10 +168,11 @@ class Config: **If False**:: .. attribute:: attr1 - :type: int Description of `attr1` + :type: int + napoleon_use_param : :obj:`bool` (Defaults to True) True to use a ``:param:`` role for each function parameter. False to use a single ``:parameters:`` role for all the parameters. diff --git a/sphinx/ext/napoleon/docstring.py b/sphinx/ext/napoleon/docstring.py index 32edd7f8f..769d1ed22 100644 --- a/sphinx/ext/napoleon/docstring.py +++ b/sphinx/ext/napoleon/docstring.py @@ -588,12 +588,13 @@ class GoogleDocstring: lines.append('.. attribute:: ' + _name) if self._opt and 'noindex' in self._opt: lines.append(' :noindex:') - if _type: - lines.extend(self._indent([':type: %s' % _type], 3)) lines.append('') fields = self._format_field('', '', _desc) lines.extend(self._indent(fields, 3)) + if _type: + lines.append('') + lines.extend(self._indent([':type: %s' % _type], 3)) lines.append('') if self._config.napoleon_use_ivar: lines.append('') |
