1
0
mirror of https://github.com/django/django.git synced 2025-01-26 18:19:18 +00:00

[4.2.x] Fixed #34756 -- Fixed docs HTML build on Sphinx 7.1+.

Backport of b3e0170ab546a96930ce3114b0a1a560953c0ff4 from main
This commit is contained in:
David Smith 2023-08-01 21:22:53 +01:00 committed by Mariusz Felisiak
parent a750fd0d7f
commit 951dcbb2e6

View File

@ -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(")")