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

autosummary "first-sentence" detection fails in presence of abbreviations. #7865

Closed
anntzer opened this issue Jun 23, 2020 · 1 comment
Closed
Labels
Milestone

Comments

@anntzer
Copy link
Contributor

anntzer commented Jun 23, 2020

Describe the bug

If a docstring's first sentence contains an abbreviation such as i.e., autosummary incorrectly cuts the summary immediately after the abbreviation.

To Reproduce
Steps to reproduce the behavior:

$ sphinx-quickstart --sep -m -p foo -a author -r0 -len --extensions sphinx.ext.autosummary

edit index.html to contain

.. autosummary::
   foo.foo

and foo.py to contain

def foo():
    """
    Does foo, i.e. fooing the thing.
    """

then build with make html and open the built docs.

This results in
test
i.e. the docstring summary is cut.

Expected behavior

Not cutting the summary.

The summary detection logic is at https://github.com/sphinx-doc/sphinx/blob/3.x/sphinx/ext/autosummary/__init__.py#L526 (basically splitting at dots followed by whitespace). I can think of two ways for fixing it: either check that the dot is not followed by a lowercase character, or just special-case i.e. and perhaps a couple of other abbreviations.

Environment info

  • OS: linux
  • Python version: 3.8.1
  • Sphinx version: 3.1.0
  • Sphinx extensions: autosummary

Additional context
N/A

@tk0miya
Copy link
Member

tk0miya commented Jun 27, 2020

Thank you for reporting. I choose the latter way in #7877.

tk0miya added a commit that referenced this issue Jun 28, 2020
Fix #7865: autosummary: Failed to extract summary line when abbr. found
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants