diff options
author | Keewis <keewis@posteo.de> | 2020-08-07 15:32:11 +0200 |
---|---|---|
committer | Keewis <keewis@posteo.de> | 2020-08-07 15:32:11 +0200 |
commit | 9d60f3456f74cb98f2a3d442a2be13ad7099a4d4 (patch) | |
tree | f903ecee0c95863a394a613b746a841b6d24be87 | |
parent | 79a24710328e712c13dc65c5e5eb1f189c20db3d (diff) | |
download | sphinx-git-9d60f3456f74cb98f2a3d442a2be13ad7099a4d4.tar.gz |
return a documenter instance instead of just the class
-rw-r--r-- | sphinx/ext/autosummary/__init__.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sphinx/ext/autosummary/__init__.py b/sphinx/ext/autosummary/__init__.py index 08accc3bb..d2fe4af68 100644 --- a/sphinx/ext/autosummary/__init__.py +++ b/sphinx/ext/autosummary/__init__.py @@ -299,13 +299,14 @@ class Autosummary(SphinxDirective): raise exc # re-raise ImportError if instance attribute not found def create_documenter(self, app: Sphinx, obj: Any, - parent: Any, name: str) -> "Type[Documenter]": + parent: Any, full_name: str) -> "Type[Documenter]": """Get an autodoc.Documenter class suitable for documenting the given object. Wraps get_documenter and is meant as a hook for extensions. """ - return get_documenter(app, obj, parent) + doccls = get_documenter(app, obj, parent) + return doccls(self.bridge, full_name) def get_items(self, names: List[str]) -> List[Tuple[str, str, str, str]]: """Try to import the given names, and return a list of @@ -338,8 +339,7 @@ class Autosummary(SphinxDirective): full_name = modname + '::' + full_name[len(modname) + 1:] # NB. using full_name here is important, since Documenters # handle module prefixes slightly differently - doccls = self.create_documenter(self.env.app, obj, parent, real_name) - documenter = doccls(self.bridge, full_name) + documenter = self.create_documenter(self.env.app, obj, parent, full_name) if not documenter.parse_name(): logger.warning(__('failed to parse name %s'), real_name, location=self.get_source_info()) |