Skip to content

Commit

Permalink
Fixed #34756 -- Fixed docs HTML build on Sphinx 7.1+.
Browse files Browse the repository at this point in the history
  • Loading branch information
smithdc1 authored and felixxm committed Aug 3, 2023
1 parent 9b9c805 commit b3e0170
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions docs/_ext/djangodocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from docutils.parsers.rst import Directive
from docutils.statemachine import ViewList
from sphinx import addnodes
from sphinx import version_info as sphinx_version
from sphinx.builders.html import StandaloneHTMLBuilder
from sphinx.directives.code import CodeBlock
from sphinx.domains.std import Cmdoption
Expand Down Expand Up @@ -127,12 +128,23 @@ def depart_table(self, node):

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(")")
Expand Down

0 comments on commit b3e0170

Please sign in to comment.