Skip to content

Commit

Permalink
Fix format_signatures to work with Sphinx < 7.3 (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbms authored Jul 25, 2024
1 parent 162f262 commit 6118569
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions sphinx_immaterial/apidoc/format_signatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,18 +577,20 @@ def _sig_transform_parameter(
ignored, node, "(", ")"
)
),
sphinx.addnodes.desc_type_parameter_list: (
lambda ignored, node: _sig_transform_desc_parameter_list(
ignored, node, "[", "]"
)
),
sphinx.addnodes.desc_parameter: _sig_transform_parameter,
sphinx.addnodes.desc_type_parameter: _sig_transform_parameter,
sphinx.addnodes.desc_returns: _sig_transform_desc_returns,
sphinx.addnodes.pending_xref: _sig_transform_generic,
sphinx.ext.viewcode.viewcode_anchor: _sig_transform_viewcode_anchor,
}

if sphinx.version_info >= (7, 3):
_SIG_TRANSFORM_FUNCS[
sphinx.addnodes.desc_type_parameter_list
] = lambda ignored, node: _sig_transform_desc_parameter_list(
ignored, node, "[", "]"
)
_SIG_TRANSFORM_FUNCS[sphinx.addnodes.desc_type_parameter] = _sig_transform_parameter


def _sig_transform_node(
ignored: set[int], node: docutils.nodes.Node
Expand Down

0 comments on commit 6118569

Please sign in to comment.