本文整理汇总了Python中docutils.writers.html5_polyglot.HTMLTranslator.depart_caption方法的典型用法代码示例。如果您正苦于以下问题:Python HTMLTranslator.depart_caption方法的具体用法?Python HTMLTranslator.depart_caption怎么用?Python HTMLTranslator.depart_caption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类docutils.writers.html5_polyglot.HTMLTranslator
的用法示例。
在下文中一共展示了HTMLTranslator.depart_caption方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: depart_caption
# 需要导入模块: from docutils.writers.html5_polyglot import HTMLTranslator [as 别名]
# 或者: from docutils.writers.html5_polyglot.HTMLTranslator import depart_caption [as 别名]
def depart_caption(self, node):
# type: (nodes.Node) -> None
self.body.append('</span>')
# append permalink if available
if isinstance(node.parent, nodes.container) and node.parent.get('literal_block'):
self.add_permalink_ref(node.parent, _('Permalink to this code'))
elif isinstance(node.parent, nodes.figure):
image_nodes = node.parent.traverse(nodes.image)
target_node = image_nodes and image_nodes[0] or node.parent
self.add_permalink_ref(target_node, _('Permalink to this image'))
elif node.parent.get('toctree'):
self.add_permalink_ref(node.parent.parent, _('Permalink to this toctree'))
if isinstance(node.parent, nodes.container) and node.parent.get('literal_block'):
self.body.append('</div>\n')
else:
BaseTranslator.depart_caption(self, node)