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
|
||||
* #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
|
||||
--------
|
||||
|
@ -77,7 +77,7 @@ from sphinx.ext.autodoc.directive import DocumenterBridge, Options
|
||||
from sphinx.ext.autodoc.importer import import_module
|
||||
from sphinx.pycode import ModuleAnalyzer, PycodeError
|
||||
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:
|
||||
# For type annotation
|
||||
@ -374,17 +374,19 @@ class Autosummary(Directive):
|
||||
def append_row(*column_texts):
|
||||
# type: (unicode) -> None
|
||||
row = nodes.row('')
|
||||
source, line = self.state_machine.get_source_and_line()
|
||||
for text in column_texts:
|
||||
node = nodes.paragraph('')
|
||||
vl = ViewList()
|
||||
vl.append(text, '<autosummary>')
|
||||
self.state.nested_parse(vl, 0, node)
|
||||
try:
|
||||
if isinstance(node[0], nodes.paragraph):
|
||||
node = node[0]
|
||||
except IndexError:
|
||||
pass
|
||||
row.append(nodes.entry('', node))
|
||||
vl.append(text, '%s:%d:<autosummary>' % (source, line))
|
||||
with switch_source_input(self.state, vl):
|
||||
self.state.nested_parse(vl, 0, node)
|
||||
try:
|
||||
if isinstance(node[0], nodes.paragraph):
|
||||
node = node[0]
|
||||
except IndexError:
|
||||
pass
|
||||
row.append(nodes.entry('', node))
|
||||
body.append(row)
|
||||
|
||||
for name, sig, summary, real_name in items:
|
||||
|
Loading…
Reference in New Issue
Block a user