Skip to content

Commit

Permalink
fix: fix depart_hint function
Browse files Browse the repository at this point in the history
  • Loading branch information
atrnh committed May 24, 2023
1 parent 4d182c5 commit e347358
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/sphinxcontrib/specs/admonitions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from typing import TYPE_CHECKING

from docutils import nodes
from docutils.parsers.rst.directives.admonitions import BaseAdmonition
from docutils.parsers.rst.roles import set_classes
from docutils import nodes

from sphinx.writers.html5 import HTML5Translator

if TYPE_CHECKING:
Expand Down Expand Up @@ -43,47 +42,38 @@ def run(self):


class Attention(OverrideAdmonition):

node_class = nodes.attention


class Caution(OverrideAdmonition):

node_class = nodes.caution


class Danger(OverrideAdmonition):

node_class = nodes.danger


class Error(OverrideAdmonition):

node_class = nodes.error


class Hint(OverrideAdmonition):

node_class = nodes.hint


class Important(OverrideAdmonition):

node_class = nodes.important


class Note(OverrideAdmonition):

node_class = nodes.note


class Tip(OverrideAdmonition):

node_class = nodes.tip


class Warning(OverrideAdmonition):

node_class = nodes.warning


Expand Down Expand Up @@ -149,8 +139,7 @@ def visit_note(self, node: nodes.note):

def depart_hint(self, node: nodes.hint):
self.body.append("</details>")

super(HTML5Translator, self).depart_hint(node)
depart_admonition(self, node)


def visit_paragraph(self, node: nodes.paragraph):
Expand All @@ -159,7 +148,7 @@ def visit_paragraph(self, node: nodes.paragraph):


def depart_paragraph(self, node: nodes.paragraph):
super(HTML5Translator, self).depart_paragraph(node)
super(self.__class__, self).depart_paragraph(node)

# For handling hints
if "admonition-title" in node["classes"] and isinstance(node.parent, nodes.hint):
Expand Down

0 comments on commit e347358

Please sign in to comment.