diff options
Diffstat (limited to 'sphinx/application.py')
-rw-r--r-- | sphinx/application.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sphinx/application.py b/sphinx/application.py index 577ec9ac8..68b221af8 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -990,8 +990,8 @@ class Sphinx: else: lexer_classes[alias] = lexer - def add_autodocumenter(self, cls): - # type: (Any) -> None + def add_autodocumenter(self, cls, override=False): + # type: (Any, bool) -> None """Register a new documenter class for the autodoc extension. Add *cls* as a new documenter class for the :mod:`sphinx.ext.autodoc` @@ -1003,11 +1003,13 @@ class Sphinx: .. todo:: Add real docs for Documenter and subclassing .. versionadded:: 0.6 + .. versionchanged:: 2.2 + Add *override* keyword. """ logger.debug('[app] adding autodocumenter: %r', cls) from sphinx.ext.autodoc.directive import AutodocDirective 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): # type: (Type, Callable[[Any, str, Any], Any]) -> None |