Skip to content

Commit

Permalink
Merge pull request #10135 from tk0miya/10121_depart_admonitions
Browse files Browse the repository at this point in the history
Fix #10121: html: <div> tag for admonition is not closed w/ docutils-0.18
  • Loading branch information
tk0miya committed Jan 30, 2022
2 parents 0aa2c92 + 5be4f47 commit 65c6684
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion sphinx/writers/html.py
Expand Up @@ -14,7 +14,7 @@
import re
import urllib.parse
import warnings
from typing import TYPE_CHECKING, Iterable, Tuple, cast
from typing import TYPE_CHECKING, Iterable, Optional, Tuple, cast

from docutils import nodes
from docutils.nodes import Element, Node, Text
Expand Down Expand Up @@ -285,6 +285,9 @@ def visit_admonition(self, node: Element, name: str = '') -> None:
node.insert(0, nodes.title(name, admonitionlabels[name]))
self.set_first_last(node)

def depart_admonition(self, node: Optional[Element] = None) -> None:
self.body.append('</div>\n')

def visit_seealso(self, node: Element) -> None:
self.visit_admonition(node, 'seealso')

Expand Down
5 changes: 4 additions & 1 deletion sphinx/writers/html5.py
Expand Up @@ -13,7 +13,7 @@
import re
import urllib.parse
import warnings
from typing import TYPE_CHECKING, Iterable, Set, Tuple, cast
from typing import TYPE_CHECKING, Iterable, Optional, Set, Tuple, cast

from docutils import nodes
from docutils.nodes import Element, Node, Text
Expand Down Expand Up @@ -259,6 +259,9 @@ def visit_admonition(self, node: Element, name: str = '') -> None:
if name:
node.insert(0, nodes.title(name, admonitionlabels[name]))

def depart_admonition(self, node: Optional[Element] = None) -> None:
self.body.append('</div>\n')

def visit_seealso(self, node: Element) -> None:
self.visit_admonition(node, 'seealso')

Expand Down

0 comments on commit 65c6684

Please sign in to comment.