mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #5151 from tk0miya/5146_wrong_location_for_autosummary_warning
Fix autosummary: warnings of autosummary indicates wrong location (refs: #5146)
This commit is contained in:
commit
6ee03240b4
1
CHANGES
1
CHANGES
@ -39,6 +39,7 @@ Bugs fixed
|
|||||||
argument
|
argument
|
||||||
* #5146: autosummary: warning is emitted when the first line of docstring ends
|
* #5146: autosummary: warning is emitted when the first line of docstring ends
|
||||||
with literal notation
|
with literal notation
|
||||||
|
* autosummary: warnings of autosummary indicates wrong location (refs: #5146)
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
@ -77,7 +77,7 @@ from sphinx.ext.autodoc.directive import DocumenterBridge, Options
|
|||||||
from sphinx.ext.autodoc.importer import import_module
|
from sphinx.ext.autodoc.importer import import_module
|
||||||
from sphinx.pycode import ModuleAnalyzer, PycodeError
|
from sphinx.pycode import ModuleAnalyzer, PycodeError
|
||||||
from sphinx.util import import_object, rst, logging
|
from sphinx.util import import_object, rst, logging
|
||||||
from sphinx.util.docutils import NullReporter, new_document
|
from sphinx.util.docutils import NullReporter, new_document, switch_source_input
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
# For type annotation
|
# For type annotation
|
||||||
@ -374,17 +374,19 @@ class Autosummary(Directive):
|
|||||||
def append_row(*column_texts):
|
def append_row(*column_texts):
|
||||||
# type: (unicode) -> None
|
# type: (unicode) -> None
|
||||||
row = nodes.row('')
|
row = nodes.row('')
|
||||||
|
source, line = self.state_machine.get_source_and_line()
|
||||||
for text in column_texts:
|
for text in column_texts:
|
||||||
node = nodes.paragraph('')
|
node = nodes.paragraph('')
|
||||||
vl = ViewList()
|
vl = ViewList()
|
||||||
vl.append(text, '<autosummary>')
|
vl.append(text, '%s:%d:<autosummary>' % (source, line))
|
||||||
self.state.nested_parse(vl, 0, node)
|
with switch_source_input(self.state, vl):
|
||||||
try:
|
self.state.nested_parse(vl, 0, node)
|
||||||
if isinstance(node[0], nodes.paragraph):
|
try:
|
||||||
node = node[0]
|
if isinstance(node[0], nodes.paragraph):
|
||||||
except IndexError:
|
node = node[0]
|
||||||
pass
|
except IndexError:
|
||||||
row.append(nodes.entry('', node))
|
pass
|
||||||
|
row.append(nodes.entry('', node))
|
||||||
body.append(row)
|
body.append(row)
|
||||||
|
|
||||||
for name, sig, summary, real_name in items:
|
for name, sig, summary, real_name in items:
|
||||||
|
Loading…
Reference in New Issue
Block a user