Skip to content

Commit

Permalink
Define extra indent as a class attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Sep 25, 2022
1 parent 9ced736 commit 77cee67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sphinx/ext/autodoc/__init__.py
Expand Up @@ -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,
Expand All @@ -980,7 +981,7 @@ def __init__(self, *args: Any) -> None:

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:
Expand Down
3 changes: 3 additions & 0 deletions sphinx/ext/autosummary/__init__.py
Expand Up @@ -371,6 +371,9 @@ def get_items(self, names: List[str]) -> List[Tuple[str, str, str, str]]:

# -- 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)

Expand Down

0 comments on commit 77cee67

Please sign in to comment.