Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hoodmane committed May 7, 2024
1 parent 2da9c17 commit c2eb280
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions sphinx_js/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ def html5_visit_desc_js_type_parameter_list(
"""Define the html/text rendering for desc_js_type_parameter_list. Based on
sphinx.writers.html5.visit_desc_type_parameter_list
"""
if hasattr(self, "_visit_sig_parameter_list"):
# Sphinx 7
return self._visit_sig_parameter_list(node, addnodes.desc_parameter, "<", ">")
# Sphinx <7
self.body.append('<span class="sig-paren">&lt;</span>')
self.first_param = 1
self.optional_param_level = 0
Expand All @@ -295,19 +299,31 @@ def html5_depart_desc_js_type_parameter_list(
"""Define the html/text rendering for desc_js_type_parameter_list. Based on
sphinx.writers.html5.depart_desc_type_parameter_list
"""
if hasattr(self, "_depart_sig_parameter_list"):
# Sphinx 7
return self._depart_sig_parameter_list(node)
# Sphinx <7
self.body.append('<span class="sig-paren">&gt;</span>')


def text_visit_desc_js_type_parameter_list(
self: TextTranslator, node: nodes.Element
) -> None:
if hasattr(self, "_visit_sig_parameter_list"):
# Sphinx 7
return self._visit_sig_parameter_list(node, addnodes.desc_parameter, "<", ">")
# Sphinx <7
self.add_text("<")
self.first_param = 1 # type:ignore[attr-defined]


def text_depart_desc_js_type_parameter_list(
self: TextTranslator, node: nodes.Element
) -> None:
if hasattr(self, "_depart_sig_parameter_list"):
# Sphinx 7
return self._depart_sig_parameter_list(node)
# Sphinx <7
self.add_text(">")


Expand Down

0 comments on commit c2eb280

Please sign in to comment.