mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
revert the dispatcher changes
This commit is contained in:
@@ -1045,9 +1045,6 @@ class Sphinx:
|
||||
logger.debug('[app] adding autodoc attrgetter: %r', (typ, getter))
|
||||
self.registry.add_autodoc_attrgetter(typ, getter)
|
||||
|
||||
def add_autosummary_get_documenter(self, func: Callable) -> None:
|
||||
self.registry.add_autosummary_get_documenter(func)
|
||||
|
||||
def add_search_language(self, cls: Any) -> None:
|
||||
"""Register a new language for the HTML search index.
|
||||
|
||||
|
||||
@@ -298,25 +298,6 @@ class Autosummary(SphinxDirective):
|
||||
|
||||
raise exc # re-raise ImportError if instance attribute not found
|
||||
|
||||
def dispatch_get_documenter(self, obj, parent, real_name):
|
||||
app = self.env.app
|
||||
documenters = [
|
||||
func(self, obj, parent, real_name)
|
||||
for func in app.registry.custom_get_documenter_funcs
|
||||
]
|
||||
sorted_documenters = sorted(
|
||||
[
|
||||
documenter
|
||||
for documenter in documenters
|
||||
if documenter is not NotImplemented
|
||||
],
|
||||
key=lambda d: d.priority,
|
||||
)
|
||||
if sorted_documenters:
|
||||
return sorted_documenters[-1]
|
||||
else:
|
||||
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), ...]``.
|
||||
@@ -348,7 +329,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.dispatch_get_documenter(obj, parent, real_name)
|
||||
doccls = get_documenter(self.env.app, obj, parent)
|
||||
documenter = doccls(self.bridge, full_name)
|
||||
if not documenter.parse_name():
|
||||
logger.warning(__('failed to parse name %s'), real_name,
|
||||
|
||||
@@ -61,9 +61,6 @@ class SphinxComponentRegistry:
|
||||
#: autodoc documenters; a dict of documenter name -> documenter class
|
||||
self.documenters = {} # type: Dict[str, Type[Documenter]]
|
||||
|
||||
#: autosummary documenter functions
|
||||
self.custom_get_documenter_funcs = [] # type: List[Callable]
|
||||
|
||||
#: css_files; a list of tuple of filename and attributes
|
||||
self.css_files = [] # type: List[Tuple[str, Dict[str, str]]]
|
||||
|
||||
@@ -363,9 +360,6 @@ class SphinxComponentRegistry:
|
||||
attrgetter: Callable[[Any, str, Any], Any]) -> None:
|
||||
self.autodoc_attrgettrs[typ] = attrgetter
|
||||
|
||||
def add_autosummary_get_documenter(self, func: Callable) -> None:
|
||||
self.custom_get_documenter_funcs.append(func)
|
||||
|
||||
def add_css_files(self, filename: str, **attributes: str) -> None:
|
||||
self.css_files.append((filename, attributes))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user