mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '1.7' into 5146_wrong_location_for_autosummary_warning
This commit is contained in:
commit
e222b38d85
6
CHANGES
6
CHANGES
@ -33,6 +33,12 @@ 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
|
||||
* #5076: napoleon raises RuntimeError with python 3.7
|
||||
* #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
|
||||
* autosummary: warnings of autosummary indicates wrong location (refs: #5146)
|
||||
|
||||
Testing
|
||||
|
@ -60,15 +60,15 @@ if __version__.endswith('+'):
|
||||
pass
|
||||
|
||||
|
||||
def main(*args, **kwargs):
|
||||
def main(argv=sys.argv):
|
||||
from .cmd import build
|
||||
warnings.warn(
|
||||
'`sphinx.main()` has moved to `sphinx.cmd.build.main()`.',
|
||||
RemovedInSphinx20Warning,
|
||||
stacklevel=2,
|
||||
)
|
||||
args = args[1:] # skip first argument to adjust arguments (refs: #4615)
|
||||
return build.main(*args, **kwargs)
|
||||
argv = argv[1:] # skip first argument to adjust arguments (refs: #4615)
|
||||
return build.main(argv)
|
||||
|
||||
|
||||
def build_main(argv=sys.argv):
|
||||
|
@ -32,7 +32,7 @@ def make_main(argv=sys.argv[1:]):
|
||||
|
||||
def main(argv=sys.argv[1:]):
|
||||
# type: (List[str]) -> int
|
||||
if sys.argv[1:2] == ['-M']:
|
||||
if argv[:1] == ['-M']:
|
||||
return make_main(argv)
|
||||
else:
|
||||
return build_main(argv)
|
||||
|
@ -91,6 +91,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
periods_re = re.compile(r'\.(?:\s+)')
|
||||
literal_re = re.compile(r'::\s*$')
|
||||
|
||||
|
||||
# -- autosummary_toc node ------------------------------------------------------
|
||||
@ -486,6 +487,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
|
||||
|
||||
|
||||
|
@ -527,7 +527,14 @@ class GoogleDocstring(UnicodeMixin):
|
||||
self._parsed_lines = self._consume_empty()
|
||||
|
||||
if self._name and (self._what == 'attribute' or self._what == 'data'):
|
||||
self._parsed_lines.extend(self._parse_attribute_docstring())
|
||||
# Implicit stop using StopIteration no longer allowed in
|
||||
# Python 3.7; see PEP 479
|
||||
res = [] # type: List[unicode]
|
||||
try:
|
||||
res = self._parse_attribute_docstring()
|
||||
except StopIteration:
|
||||
pass
|
||||
self._parsed_lines.extend(res)
|
||||
return
|
||||
|
||||
while self._line_iter.has_next():
|
||||
|
@ -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 == ''
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user