Merge pull request #5152 from tk0miya/5146_autosummary_and_literal_notation

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-13 01:56:52 +09:00 committed by GitHub
commit 9fcbfa859e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -37,6 +37,8 @@ Bugs fixed
* #5125: sphinx-build: Interface of ``sphinx:main()`` has changed
* sphinx-build: ``sphinx.cmd.build.main()`` refers ``sys.argv`` instead of given
argument
* #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 == ''