Skip to content

Commit

Permalink
Fix HTML 4
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Jun 6, 2022
1 parent 711f620 commit ac929ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
5 changes: 4 additions & 1 deletion sphinx/transforms/post_transforms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,10 @@ def run(self, **kwargs: Any) -> None:
# result in a "Losing ids" exception if there is a target node before
# the only node, so we make sure docutils can transfer the id to
# something, even if it's just a comment and will lose the id anyway...
process_collapsible_nodes(self.document, self.app.builder.name)
builder_name = self.app.builder.name
if getattr(self.app.builder.config, "html4_writer", False):
builder_name = "html4"
process_collapsible_nodes(self.document, builder_name)


class SigElementFallbackTransform(SphinxPostTransform):
Expand Down
12 changes: 0 additions & 12 deletions sphinx/writers/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,18 +702,6 @@ def visit_option_group(self, node: Element) -> None:
super().visit_option_group(node)
self.context[-2] = self.context[-2].replace(' ', ' ')

def visit_collapsible(self, node: Element) -> None:
self.body.append('<details>')

def depart_collapsible(self, node: Element) -> None:
self.body.append('</details>')

def visit_collapsible_summary(self, node: Element) -> None:
self.body.append('<summary>')

def depart_collapsible_summary(self, node: Element) -> None:
self.body.append('</summary>')

# overwritten
def visit_Text(self, node: Text) -> None:
text = node.astext()
Expand Down

0 comments on commit ac929ac

Please sign in to comment.