mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
add a create_documenter method wrapping get_documenter
This commit is contained in:
parent
78e4499435
commit
79a2471032
@ -298,6 +298,15 @@ 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]":
|
||||
"""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)
|
||||
|
||||
def get_items(self, names: List[str]) -> List[Tuple[str, str, str, str]]:
|
||||
"""Try to import the given names, and return a list of
|
||||
``[(name, signature, summary_string, real_name), ...]``.
|
||||
@ -329,7 +338,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 = get_documenter(self.env.app, obj, parent)
|
||||
doccls = self.create_documenter(self.env.app, obj, parent, real_name)
|
||||
documenter = doccls(self.bridge, full_name)
|
||||
if not documenter.parse_name():
|
||||
logger.warning(__('failed to parse name %s'), real_name,
|
||||
|
Loading…
Reference in New Issue
Block a user