mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Close #6475: Add override argument to app.add_autodocumenter()
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -31,6 +31,7 @@ Features added
|
|||||||
:confval:`html_extra_path` directories are inside output directory
|
:confval:`html_extra_path` directories are inside output directory
|
||||||
* #6514: html: Add a label to search input for accessability purposes
|
* #6514: html: Add a label to search input for accessability purposes
|
||||||
* #5602: apidoc: Add ``--templatedir`` option
|
* #5602: apidoc: Add ``--templatedir`` option
|
||||||
|
* #6475: Add ``override`` argument to ``app.add_autodocumenter()``
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
|||||||
@@ -1054,8 +1054,8 @@ class Sphinx:
|
|||||||
else:
|
else:
|
||||||
lexer_classes[alias] = lexer
|
lexer_classes[alias] = lexer
|
||||||
|
|
||||||
def add_autodocumenter(self, cls):
|
def add_autodocumenter(self, cls, override=False):
|
||||||
# type: (Any) -> None
|
# type: (Any, bool) -> None
|
||||||
"""Register a new documenter class for the autodoc extension.
|
"""Register a new documenter class for the autodoc extension.
|
||||||
|
|
||||||
Add *cls* as a new documenter class for the :mod:`sphinx.ext.autodoc`
|
Add *cls* as a new documenter class for the :mod:`sphinx.ext.autodoc`
|
||||||
@@ -1067,11 +1067,13 @@ class Sphinx:
|
|||||||
.. todo:: Add real docs for Documenter and subclassing
|
.. todo:: Add real docs for Documenter and subclassing
|
||||||
|
|
||||||
.. versionadded:: 0.6
|
.. versionadded:: 0.6
|
||||||
|
.. versionchanged:: 2.2
|
||||||
|
Add *override* keyword.
|
||||||
"""
|
"""
|
||||||
logger.debug('[app] adding autodocumenter: %r', cls)
|
logger.debug('[app] adding autodocumenter: %r', cls)
|
||||||
from sphinx.ext.autodoc.directive import AutodocDirective
|
from sphinx.ext.autodoc.directive import AutodocDirective
|
||||||
self.registry.add_documenter(cls.objtype, cls)
|
self.registry.add_documenter(cls.objtype, cls)
|
||||||
self.add_directive('auto' + cls.objtype, AutodocDirective)
|
self.add_directive('auto' + cls.objtype, AutodocDirective, override=override)
|
||||||
|
|
||||||
def add_autodoc_attrgetter(self, typ, getter):
|
def add_autodoc_attrgetter(self, typ, getter):
|
||||||
# type: (Type, Callable[[Any, str, Any], Any]) -> None
|
# type: (Type, Callable[[Any, str, Any], Any]) -> None
|
||||||
|
|||||||
Reference in New Issue
Block a user