mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #8190: autodoc: parse error for docstring w/o ending blank lines
autodoc raises a parsing error if some extension generates a docstring not having blank lines at the tail. This appends a blank line if generated one does not contain it.
This commit is contained in:
parent
31f26a0bbf
commit
fd3d654c17
2
CHANGES
2
CHANGES
@ -19,6 +19,8 @@ Bugs fixed
|
|||||||
* #8085: i18n: Add support for having single text domain
|
* #8085: i18n: Add support for having single text domain
|
||||||
* #8143: autodoc: AttributeError is raised when False value is passed to
|
* #8143: autodoc: AttributeError is raised when False value is passed to
|
||||||
autodoc_default_options
|
autodoc_default_options
|
||||||
|
* #8190: autodoc: parsing error is raised if some extension replaces docstring
|
||||||
|
by string not ending with blank lines
|
||||||
* #8093: The highlight warning has wrong location in some builders (LaTeX,
|
* #8093: The highlight warning has wrong location in some builders (LaTeX,
|
||||||
singlehtml and so on)
|
singlehtml and so on)
|
||||||
|
|
||||||
|
@ -535,6 +535,11 @@ class Documenter:
|
|||||||
self.env.app.emit('autodoc-process-docstring',
|
self.env.app.emit('autodoc-process-docstring',
|
||||||
self.objtype, self.fullname, self.object,
|
self.objtype, self.fullname, self.object,
|
||||||
self.options, docstringlines)
|
self.options, docstringlines)
|
||||||
|
|
||||||
|
if docstringlines and docstringlines[-1] != '':
|
||||||
|
# append a blank line to the end of the docstring
|
||||||
|
docstringlines.append('')
|
||||||
|
|
||||||
yield from docstringlines
|
yield from docstringlines
|
||||||
|
|
||||||
def get_sourcename(self) -> str:
|
def get_sourcename(self) -> str:
|
||||||
|
@ -28,7 +28,8 @@ def test_process_docstring(app):
|
|||||||
'.. py:function:: func()',
|
'.. py:function:: func()',
|
||||||
' :module: target.process_docstring',
|
' :module: target.process_docstring',
|
||||||
'',
|
'',
|
||||||
' my docstring'
|
' my docstring',
|
||||||
|
'',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user