Fix #5146: autosummary: warning is emitted when the first line of docstring ends with literal notation

This commit is contained in:
Takeshi KOMIYA 2018-07-08 21:14:01 +09:00
parent e78133a83e
commit a2f6de88c1
3 changed files with 10 additions and 0 deletions

View File

@ -33,6 +33,8 @@ Bugs fixed
* #5091: latex: curly braces in index entries are not handled correctly
* #5070: epub: Wrong internal href fragment links
* #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
--------

View File

@ -91,6 +91,7 @@ logger = logging.getLogger(__name__)
periods_re = re.compile(r'\.(?:\s+)')
literal_re = re.compile(r'::\s*$')
# -- autosummary_toc node ------------------------------------------------------
@ -484,6 +485,9 @@ def extract_summary(doc, document):
# considered as that splitting by period does not break inline markups
break
# strip literal notation mark ``::`` from tail of summary
summary = literal_re.sub('.', summary)
return summary

View File

@ -81,6 +81,10 @@ def test_extract_summary(capsys):
doc = ['Blabla, i.e. bla.']
assert extract_summary(doc, document) == 'Blabla, i.e.'
# literal
doc = ['blah blah::']
assert extract_summary(doc, document) == 'blah blah.'
_, err = capsys.readouterr()
assert err == ''