diff --git a/CHANGES b/CHANGES index b0dc46b9a..e6888146c 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,7 @@ Features added -------------- * #7853: C and C++, support parameterized GNU style attributes. +* #7888: napoleon: Add aliases Warn and Raise. Bugs fixed ---------- diff --git a/doc/usage/extensions/napoleon.rst b/doc/usage/extensions/napoleon.rst index b12dd03ba..76c423dc0 100644 --- a/doc/usage/extensions/napoleon.rst +++ b/doc/usage/extensions/napoleon.rst @@ -115,6 +115,7 @@ All of the following section headers are supported: * ``Parameters`` * ``Return`` *(alias of Returns)* * ``Returns`` + * ``Raise`` *(alias of Raises)* * ``Raises`` * ``References`` * ``See Also`` @@ -122,6 +123,7 @@ All of the following section headers are supported: * ``Todo`` * ``Warning`` * ``Warnings`` *(alias of Warning)* + * ``Warn`` *(alias of Warns)* * ``Warns`` * ``Yield`` *(alias of Yields)* * ``Yields`` diff --git a/sphinx/ext/napoleon/docstring.py b/sphinx/ext/napoleon/docstring.py index 769d1ed22..5857fcf92 100644 --- a/sphinx/ext/napoleon/docstring.py +++ b/sphinx/ext/napoleon/docstring.py @@ -162,6 +162,7 @@ class GoogleDocstring: 'parameters': self._parse_parameters_section, 'return': self._parse_returns_section, 'returns': self._parse_returns_section, + 'raise': self._parse_raises_section, 'raises': self._parse_raises_section, 'references': self._parse_references_section, 'see also': self._parse_see_also_section, @@ -169,6 +170,7 @@ class GoogleDocstring: 'todo': partial(self._parse_admonition, 'todo'), 'warning': partial(self._parse_admonition, 'warning'), 'warnings': partial(self._parse_admonition, 'warning'), + 'warn': self._parse_warns_section, 'warns': self._parse_warns_section, 'yield': self._parse_yields_section, 'yields': self._parse_yields_section,