本文整理汇总了Python中sphinx.writers.html.HTMLTranslator.visit_block_quote方法的典型用法代码示例。如果您正苦于以下问题:Python HTMLTranslator.visit_block_quote方法的具体用法?Python HTMLTranslator.visit_block_quote怎么用?Python HTMLTranslator.visit_block_quote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sphinx.writers.html.HTMLTranslator
的用法示例。
在下文中一共展示了HTMLTranslator.visit_block_quote方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: visit_block_quote
# 需要导入模块: from sphinx.writers.html import HTMLTranslator [as 别名]
# 或者: from sphinx.writers.html.HTMLTranslator import visit_block_quote [as 别名]
def visit_block_quote(self, node):
quote_slide_tags = ['paragraph', 'attribution']
# see if this looks like a quote slide
if (len(node.children) <= 2 and
[c.tagname for c in node.children] == quote_slide_tags[:len(node.children)]):
# process this as a quote slide
# first child must be a paragraph, process it as a <q> element
p = node.children[0]
self.body.append(self.starttag(node, 'q'))
for text_item in p:
text_item.walkabout(self)
self.body.append('</q>\n')
# optional second child must be an attribution, processing as a <div>
# following the <q>
if len(node.children) > 1:
attr = node.children[1]
self.body.append(self.starttag(attr, 'div', CLASS="author"))
for text_item in attr:
text_item.walkabout(self)
self.body.append('</div>\n')
# skip all normal processing
raise nodes.SkipNode
else:
return HTMLTranslator.visit_block_quote(self, node)