Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

napoleon fails to parse tilde in :exc: role #6999

Closed
goodmami opened this issue Jan 8, 2020 · 1 comment
Closed

napoleon fails to parse tilde in :exc: role #6999

goodmami opened this issue Jan 8, 2020 · 1 comment

Comments

@goodmami
Copy link

goodmami commented Jan 8, 2020

Describe the bug

The Raises: section of a Napoleon docstring fails to properly render exceptions when enclosed in the :exc: role and using tildes for short names.

To Reproduce

>>> from sphinx.ext.napoleon import GoogleDocstring, NumpyDocstring
>>> gdocstring = '''
... Raises:
...     foo.bar.Error
...         If blah
...     ~foo.baz.Error
...         If yadda
...     :exc:`foo.hoge.Error`
...         If naninani
...     :exc:`~foo.piyo.Error`
...         If nantoka
... '''
>>> print('\n'.join(GoogleDocstring(gdocstring).lines()))

:raises foo.bar.Error: If blah
:raises ~foo.baz.Error: If yadda
:raises foo.hoge.Error: If naninani
:raises :exc:`~foo.piyo.Error`: If nantoka

>>> ndocstring = '''
... Raises
... ------
... foo.bar.Error
...     If blah
... ~foo.baz.Error
...     If yadda
... :exc:`foo.hoge.Error`
...     If naninani
... :exc:`~foo.piyo.Error`
...     If nantoka
... '''
>>> print('\n'.join(NumpyDocstring(ndocstring).lines()))

:raises foo.bar.Error: If blah
:raises ~foo.baz.Error: If yadda
:raises foo.hoge.Error: If naninani
:raises :exc:`~foo.piyo.Error`: If nantoka

Expected behavior

I expect the final pattern (foo.piyo.Error above) to render like the second one (foo.baz.Error above).

Environment info

  • OS: Pop!_OS (Ubuntu) Linux 19.10
  • Python version: 3.7.5
  • Sphinx version: 2.3.1
  • Sphinx extensions: sphinx.ext.napoleon

Additional context

tk0miya added a commit to tk0miya/sphinx that referenced this issue Jan 8, 2020
@tk0miya tk0miya added this to the 2.4.0 milestone Jan 8, 2020
tk0miya added a commit that referenced this issue Jan 10, 2020
Fix #6999: napoleon: fails to parse tilde in :exc: role
@tk0miya
Copy link
Member

tk0miya commented Jan 10, 2020

Fixed by #7003 .
Thank you for reporting.

@tk0miya tk0miya closed this as completed Jan 10, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants