本文整理汇总了Python中docutils.nodes.SkipChildren方法的典型用法代码示例。如果您正苦于以下问题:Python nodes.SkipChildren方法的具体用法?Python nodes.SkipChildren怎么用?Python nodes.SkipChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类docutils.nodes
的用法示例。
在下文中一共展示了nodes.SkipChildren方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: visit_raw
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipChildren [as 别名]
def visit_raw(self, node):
if 'format' in node.attributes:
formats = node.attributes['format']
formatlist = formats.split()
if 'odt' in formatlist:
rawstr = node.astext()
attrstr = ' '.join(['%s="%s"' % (k, v, )
for k,v in list(CONTENT_NAMESPACE_ATTRIB.items())])
contentstr = '<stuff %s>%s</stuff>' % (attrstr, rawstr, )
if WhichElementTree != "lxml":
contentstr = contentstr.encode("utf-8")
content = etree.fromstring(contentstr)
elements = content.getchildren()
if len(elements) > 0:
el1 = elements[0]
if self.in_header:
pass
elif self.in_footer:
pass
else:
self.current_element.append(el1)
raise nodes.SkipChildren()
示例2: visit_caption
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipChildren [as 别名]
def visit_caption(self, node):
raise nodes.SkipChildren()
pass
示例3: visit_term
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipChildren [as 别名]
def visit_term(self, node):
el = self.append_p('deflist-term-%d' % self.def_list_level)
el.text = node.astext()
self.set_current_element(el)
raise nodes.SkipChildren()
示例4: visit_footnote_reference
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipChildren [as 别名]
def visit_footnote_reference(self, node):
if self.footnote_level <= 0:
id = node.attributes['ids'][0]
refid = node.attributes.get('refid')
if refid is None:
refid = ''
if self.settings.endnotes_end_doc:
note_class = 'endnote'
else:
note_class = 'footnote'
el1 = self.append_child('text:note', attrib={
'text:id': '%s' % (refid, ),
'text:note-class': note_class,
})
note_auto = str(node.attributes.get('auto', 1))
if isinstance(node, docutils.nodes.citation_reference):
citation = '[%s]' % node.astext()
el2 = SubElement(el1, 'text:note-citation', attrib={
'text:label': citation,
})
el2.text = citation
elif note_auto == '1':
el2 = SubElement(el1, 'text:note-citation', attrib={
'text:label': node.astext(),
})
el2.text = node.astext()
elif note_auto == '*':
if self.footnote_chars_idx >= len(
ODFTranslator.footnote_chars):
self.footnote_chars_idx = 0
footnote_char = ODFTranslator.footnote_chars[
self.footnote_chars_idx]
self.footnote_chars_idx += 1
el2 = SubElement(el1, 'text:note-citation', attrib={
'text:label': footnote_char,
})
el2.text = footnote_char
self.footnote_ref_dict[id] = el1
raise nodes.SkipChildren()
示例5: visit_label
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipChildren [as 别名]
def visit_label(self, node):
if isinstance(node.parent, docutils.nodes.footnote):
raise nodes.SkipChildren()
elif self.citation_id is not None:
el = self.append_p('textbody')
self.set_current_element(el)
if self.settings.create_links:
el0 = SubElement(el, 'text:span')
el0.text = '['
el1 = self.append_child('text:reference-mark-start', attrib={
'text:name': '%s' % (self.citation_id, ),
})
else:
el.text = '['
示例6: visit_description
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipChildren [as 别名]
def visit_description(self, node):
el = self.append_child('table:table-cell', attrib={
'table:style-name': 'Table%d.B2' % self.table_count,
'office:value-type': 'string',
})
el1 = SubElement(el, 'text:p', attrib={
'text:style-name': 'Table_20_Contents'})
el1.text = node.astext()
raise nodes.SkipChildren()
示例7: visit_substitution_definition
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipChildren [as 别名]
def visit_substitution_definition(self, node):
raise nodes.SkipChildren()
示例8: visit_title_reference
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipChildren [as 别名]
def visit_title_reference(self, node):
el = self.append_child('text:span', attrib={
'text:style-name': self.rststyle('quotation')})
el.text = self.encode(node.astext())
raise nodes.SkipChildren()