本文整理匯總了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)