diff options
author | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2022-09-25 21:55:15 +0300 |
---|---|---|
committer | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2022-09-25 22:23:53 +0300 |
commit | 77cee67f1155a5f869e2f47d834a86f650891807 (patch) | |
tree | d84366ac1c4fc6ad84d9932a6bce532d5c4cd850 | |
parent | 9ced73631695890638a2d412ef3d916ec02d63e7 (diff) |
Define extra indent as a class attribute
-rw-r--r-- | sphinx/ext/autodoc/__init__.py | 3 | ||||
-rw-r--r-- | sphinx/ext/autosummary/__init__.py | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index c6088f45d..93df64bb1 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -961,6 +961,7 @@ class ModuleDocumenter(Documenter): objtype = 'module' content_indent = '' titles_allowed = True + _extra_indent = ' ' option_spec: OptionSpec = { 'members': members_option, 'undoc-members': bool_option, @@ -980,7 +981,7 @@ class ModuleDocumenter(Documenter): def add_content(self, more_content: Optional[StringList]) -> None: old_indent = self.indent - self.indent += ' ' + self.indent += self._extra_indent super().add_content(None) self.indent = old_indent if more_content: diff --git a/sphinx/ext/autosummary/__init__.py b/sphinx/ext/autosummary/__init__.py index ac60216b0..f462a5e5d 100644 --- a/sphinx/ext/autosummary/__init__.py +++ b/sphinx/ext/autosummary/__init__.py @@ -371,6 +371,9 @@ class Autosummary(SphinxDirective): # -- Grab the summary + # bodge for ModuleDocumenter + documenter._extra_indent = '' # type: ignore[attr-defined] + documenter.add_content(None) summary = extract_summary(self.bridge.result.data[:], self.state.document) |