mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
allow registering custom get_documenter functions
This commit is contained in:
parent
5e6da19f0e
commit
c212f5842c
@ -1045,6 +1045,9 @@ 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.
|
||||
|
||||
|
@ -61,6 +61,9 @@ 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]]]
|
||||
|
||||
@ -360,6 +363,9 @@ 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))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user