mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-10-12 16:32:10 -05:00
#567: Emit the `autodoc-process-docstring` event even for objects without a docstring so that it can add content.
This commit is contained in:
1 parent
6964bdffb9
commit
8f37758033
2 files changed
+11
-3
No files matched your search
@@ -1,6 +1,9 @@
|
|||||||
Release 1.0.6 (in development)
|
Release 1.0.6 (in development)
|
||||||
==============================
|
==============================
|
||||||
|
|
||||||
|
* #567: Emit the ``autodoc-process-docstring`` event even for objects
|
||||||
|
without a docstring so that it can add content.
|
||||||
|
|
||||||
* #565: In the LaTeX builder, not only literal blocks require different
|
* #565: In the LaTeX builder, not only literal blocks require different
|
||||||
table handling, but also quite a few other list-like block elements.
|
table handling, but also quite a few other list-like block elements.
|
||||||
|
|
||||||
|
|||||||
@@ -457,6 +457,11 @@ class Documenter(object):
|
|||||||
if not no_docstring:
|
if not no_docstring:
|
||||||
encoding = self.analyzer and self.analyzer.encoding
|
encoding = self.analyzer and self.analyzer.encoding
|
||||||
docstrings = self.get_doc(encoding)
|
docstrings = self.get_doc(encoding)
|
||||||
|
if not docstrings:
|
||||||
|
# append at least a dummy docstring, so that the event
|
||||||
|
# autodoc-process-docstring is fired and can add some
|
||||||
|
# content if desired
|
||||||
|
docstrings.append([])
|
||||||
for i, line in enumerate(self.process_doc(docstrings)):
|
for i, line in enumerate(self.process_doc(docstrings)):
|
||||||
self.add_line(line, sourcename, i)
|
self.add_line(line, sourcename, i)
|
||||||
|
|
||||||
@@ -922,9 +927,9 @@ class ClassDocumenter(ModuleLevelDocumenter):
|
|||||||
content = self.env.config.autoclass_content
|
content = self.env.config.autoclass_content
|
||||||
|
|
||||||
docstrings = []
|
docstrings = []
|
||||||
docstring = self.get_attr(self.object, '__doc__', None)
|
attrdocstring = self.get_attr(self.object, '__doc__', None)
|
||||||
if docstring:
|
if attrdocstring:
|
||||||
docstrings.append(docstring)
|
docstrings.append(attrdocstring)
|
||||||
|
|
||||||
# for classes, what the "docstring" is can be controlled via a
|
# for classes, what the "docstring" is can be controlled via a
|
||||||
# config value; the default is only the class docstring
|
# config value; the default is only the class docstring
|
||||||
|
|||||||
Reference in new issue
Block a user