Skip to content

Commit

Permalink
autosummary: Extract summary line after "e.g." (#11196)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Turner <[email protected]>
  • Loading branch information
grayjk and AA-Turner authored Aug 7, 2023
1 parent 8cd677f commit ac2b759
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Bugs fixed
Patch by Ralf Grubenmann.
* #11529: Line Block in LaTeX builder outputs spurious empty token.
Patch by Adrian Vollmer.
* #11196: autosummary: Summary line extraction failed with "e.g."

Testing
-------
Expand Down
2 changes: 1 addition & 1 deletion sphinx/ext/autosummary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
periods_re = re.compile(r'\.(?:\s+)')
literal_re = re.compile(r'::\s*$')

WELL_KNOWN_ABBREVIATIONS = ('et al.', ' i.e.',)
WELL_KNOWN_ABBREVIATIONS = ('et al.', 'e.g.', 'i.e.')


# -- autosummary_toc node ------------------------------------------------------
Expand Down
9 changes: 9 additions & 0 deletions tests/test_ext_autosummary.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ def test_extract_summary(capsys):
doc = ['Blabla, i.e. bla.']
assert extract_summary(doc, document) == ' '.join(doc)

doc = ['Blabla, (i.e. bla).']
assert extract_summary(doc, document) == ' '.join(doc)

doc = ['Blabla, e.g. bla.']
assert extract_summary(doc, document) == ' '.join(doc)

doc = ['Blabla, (e.g. bla).']
assert extract_summary(doc, document) == ' '.join(doc)

doc = ['Blabla, et al. bla.']
assert extract_summary(doc, document) == ' '.join(doc)

Expand Down

0 comments on commit ac2b759

Please sign in to comment.