mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #5146: autosummary: warning is emitted when the first line of docstring ends with literal notation
This commit is contained in:
parent
e78133a83e
commit
a2f6de88c1
2
CHANGES
2
CHANGES
@ -33,6 +33,8 @@ Bugs fixed
|
|||||||
* #5091: latex: curly braces in index entries are not handled correctly
|
* #5091: latex: curly braces in index entries are not handled correctly
|
||||||
* #5070: epub: Wrong internal href fragment links
|
* #5070: epub: Wrong internal href fragment links
|
||||||
* #5104: apidoc: Interface of ``sphinx.apidoc:main()`` has changed
|
* #5104: apidoc: Interface of ``sphinx.apidoc:main()`` has changed
|
||||||
|
* #5146: autosummary: warning is emitted when the first line of docstring ends
|
||||||
|
with literal notation
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
@ -91,6 +91,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
periods_re = re.compile(r'\.(?:\s+)')
|
periods_re = re.compile(r'\.(?:\s+)')
|
||||||
|
literal_re = re.compile(r'::\s*$')
|
||||||
|
|
||||||
|
|
||||||
# -- autosummary_toc node ------------------------------------------------------
|
# -- autosummary_toc node ------------------------------------------------------
|
||||||
@ -484,6 +485,9 @@ def extract_summary(doc, document):
|
|||||||
# considered as that splitting by period does not break inline markups
|
# considered as that splitting by period does not break inline markups
|
||||||
break
|
break
|
||||||
|
|
||||||
|
# strip literal notation mark ``::`` from tail of summary
|
||||||
|
summary = literal_re.sub('.', summary)
|
||||||
|
|
||||||
return summary
|
return summary
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,6 +81,10 @@ def test_extract_summary(capsys):
|
|||||||
doc = ['Blabla, i.e. bla.']
|
doc = ['Blabla, i.e. bla.']
|
||||||
assert extract_summary(doc, document) == 'Blabla, i.e.'
|
assert extract_summary(doc, document) == 'Blabla, i.e.'
|
||||||
|
|
||||||
|
# literal
|
||||||
|
doc = ['blah blah::']
|
||||||
|
assert extract_summary(doc, document) == 'blah blah.'
|
||||||
|
|
||||||
_, err = capsys.readouterr()
|
_, err = capsys.readouterr()
|
||||||
assert err == ''
|
assert err == ''
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user