def depart_caption(self, node: Element) -> None:
    if (isinstance(node.parent, nodes.figure) or (isinstance(node.parent, nodes.container) and node.parent.get('literal_block'))):
        self.body.append('}\n')
def depart_caption(self, node: Element) -> None:
    if (isinstance(node.parent, nodes.figure) or (isinstance(node.parent, nodes.container) and node.parent.get('literal_block'))):
        self.body.append('}\n')