diff options
| author | David Smith <smithdc@gmail.com> | 2023-08-01 21:22:53 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-08-03 09:32:03 +0200 |
| commit | 951dcbb2e6c4d1686706f86c955509ac0ced788c (patch) | |
| tree | e213bf8b9f3763c47d1c603346b56e46ace6deb9 /docs/_ext | |
| parent | a750fd0d7f6977f6c8bdf121db589be3d6c92a03 (diff) | |
[4.2.x] Fixed #34756 -- Fixed docs HTML build on Sphinx 7.1+.
Backport of b3e0170ab546a96930ce3114b0a1a560953c0ff4 from main
Diffstat (limited to 'docs/_ext')
| -rw-r--r-- | docs/_ext/djangodocs.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/docs/_ext/djangodocs.py b/docs/_ext/djangodocs.py index 5e99f9f5e0..5a59b01039 100644 --- a/docs/_ext/djangodocs.py +++ b/docs/_ext/djangodocs.py @@ -132,12 +132,23 @@ class DjangoHTMLTranslator(HTMLTranslator): def visit_desc_parameterlist(self, node): self.body.append("(") # by default sphinx puts <big> around the "(" - self.first_param = 1 self.optional_param_level = 0 self.param_separator = node.child_text_separator - self.required_params_left = sum( + # Counts 'parameter groups' being either a required parameter, or a set + # of contiguous optional ones. + required_params = [ isinstance(c, addnodes.desc_parameter) for c in node.children - ) + ] + # How many required parameters are left. + self.required_params_left = sum(required_params) + if sphinx_version < (7, 1): + self.first_param = 1 + else: + self.is_first_param = True + self.params_left_at_level = 0 + self.param_group_index = 0 + self.list_is_required_param = required_params + self.multi_line_parameter_list = False def depart_desc_parameterlist(self, node): self.body.append(")") |
