Skip to content

Commit

Permalink
feat(python#3536): add close button to canonical banner
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobCoffee committed Dec 1, 2023
1 parent a3f2522 commit 7773fab
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def run(self) -> list[nodes.admonition]:
else:
pre_text = self.admonition_pre_text

close_button_node = nodes.paragraph('', '', nodes.Text('×'), classes=['close-button'])
close_button_node['classes'].append('close-button')

pre_text_node = nodes.paragraph(pre_text)
pre_text_node.line = self.lineno
pre_node, pre_msg = self.state.inline_text(pre_text, self.lineno)
Expand All @@ -50,6 +53,7 @@ def run(self) -> list[nodes.admonition]:
"\n".join(source_lines), classes=["pep-banner"] + self.css_classes)

admonition_node.append(pre_text_node)
admonition_node.append(close_button_node)
if self.content:
self.state.nested_parse(
self.content, self.content_offset, admonition_node)
Expand Down

0 comments on commit 7773fab

Please sign in to comment.