本文整理汇总了Python中docutils.nodes.bullet_list方法的典型用法代码示例。如果您正苦于以下问题:Python nodes.bullet_list方法的具体用法?Python nodes.bullet_list怎么用?Python nodes.bullet_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类docutils.nodes
的用法示例。
在下文中一共展示了nodes.bullet_list方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import bullet_list [as 别名]
def process(self, doctree):
for node in doctree.traverse(cfgconfig):
config = node.config
context = node.context
options = self.domain.config_options[config]
if self.builder.config.cfg_options_summary is None:
new_content = []
elif len(options) == 0:
new_content = [nodes.Text("[No options defined for this config]")]
elif self.builder.config.cfg_options_summary == "table":
new_content = self.create_summary_table(config, context, options)
elif self.builder.config.cfg_options_summary == "list":
new_content = [self.create_option_reference(o, config, context) for o in options]
if len(new_content) > 1:
listnode = nodes.bullet_list()
for entry in new_content:
listnode += nodes.list_item('', entry)
new_content = [listnode]
else:
raise ValueError("unknown value for config option `cfg_options_summary`.")
node.replace_self(new_content)
示例2: bullet
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import bullet_list [as 别名]
def bullet(self, match, context, next_state):
"""Bullet list item."""
bulletlist = nodes.bullet_list()
(bulletlist.source,
bulletlist.line) = self.state_machine.get_source_and_line()
self.parent += bulletlist
bulletlist['bullet'] = match.string[0]
i, blank_finish = self.list_item(match.end())
bulletlist += i
offset = self.state_machine.line_offset + 1 # next line
new_line_offset, blank_finish = self.nested_list_parse(
self.state_machine.input_lines[offset:],
input_offset=self.state_machine.abs_line_offset() + 1,
node=bulletlist, initial_state='BulletList',
blank_finish=blank_finish)
self.goto_line(new_line_offset)
if not blank_finish:
self.parent += self.unindent_warning('Bullet list')
return [], next_state, []
示例3: visit_list_item
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import bullet_list [as 别名]
def visit_list_item(self, node):
children = []
for child in node.children:
if not isinstance(child, nodes.Invisible):
children.append(child)
if (children and isinstance(children[0], nodes.paragraph)
and (isinstance(children[-1], nodes.bullet_list)
or isinstance(children[-1], nodes.enumerated_list))):
children.pop()
if len(children) <= 1:
return
else:
raise nodes.NodeFound
# def visit_bullet_list(self, node):
# pass
# def visit_enumerated_list(self, node):
# pass
# def visit_paragraph(self, node):
# raise nodes.SkipNode
示例4: visit_list_item
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import bullet_list [as 别名]
def visit_list_item(self, node):
# print "visiting list item", node.__class__
children = [child for child in node.children
if not isinstance(child, nodes.Invisible)]
# print "has %s visible children" % len(children)
if (children and isinstance(children[0], nodes.paragraph)
and (isinstance(children[-1], nodes.bullet_list) or
isinstance(children[-1], nodes.enumerated_list) or
isinstance(children[-1], nodes.field_list))):
children.pop()
# print "%s children remain" % len(children)
if len(children) <= 1:
return
else:
# print "found", child.__class__, "in", node.__class__
raise nodes.NodeFound
示例5: resolve_required_by_xrefs
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import bullet_list [as 别名]
def resolve_required_by_xrefs(app, env, node, contnode):
"""Now that all recipes and packages have been parsed, we are called here
for each ``pending_xref`` node that sphinx has not been able to resolve.
We handle specifically the ``requiredby`` reftype created by the
`RequiredByField` fieldtype allowed in ``conda:package::``
directives, where we replace the ``pending_ref`` node with a bullet
list of reference nodes pointing to the package pages that
"depended" on the package.
"""
if node['reftype'] == 'requiredby' and node['refdomain'] == 'conda':
target = node['reftarget']
docname = node['refdoc']
backrefs = env.domains['conda'].data['backrefs'].get(target, set())
listnode = nodes.bullet_list()
for back_docname, back_target in backrefs:
par = nodes.paragraph()
name_node = addnodes.literal_strong(back_target, back_target,
classes=['xref', 'backref'])
refnode = make_refnode(app.builder, docname,
back_docname, back_target, name_node)
refnode.set_class('conda-package')
par += refnode
listnode += nodes.list_item('', par)
return listnode
示例6: run
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import bullet_list [as 别名]
def run(self):
idb = nodes.make_id("emva1288-" + self.options['section'])
section = nodes.section(ids=[idb])
section += nodes.rubric(text='Emva1288')
lst = nodes.bullet_list()
for k in self.option_spec.keys():
if k not in self.options:
continue
item = nodes.list_item()
item += nodes.strong(text=k + ':')
item += nodes.inline(text=' ' + self.options[k])
lst += item
section += lst
return [section]
示例7: run
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import bullet_list [as 别名]
def run(self):
# XXX: do this once only
fd = pkg_resources.resource_stream ('crocoite', 'data/click.yaml')
config = list (yaml.safe_load_all (fd))
l = nodes.definition_list ()
for site in config:
urls = set ()
v = nodes.definition ()
vl = nodes.bullet_list ()
v += vl
for s in site['selector']:
i = nodes.list_item ()
i += nodes.paragraph (text=s['description'])
vl += i
urls.update (map (lambda x: URL(x).with_path ('/'), s.get ('urls', [])))
item = nodes.definition_list_item ()
term = ', '.join (map (lambda x: x.host, urls)) if urls else site['match']
k = nodes.term (text=term)
item += k
item += v
l += item
return [l]
示例8: is_compactable
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import bullet_list [as 别名]
def is_compactable(self, node):
# print "is_compactable %s ?" % node.__class__,
# explicite class arguments have precedence
if 'compact' in node['classes']:
return True
if 'open' in node['classes']:
return False
# check config setting:
if (isinstance(node, (nodes.field_list, nodes.definition_list))
and not self.settings.compact_field_lists):
# print "`compact-field-lists` is False"
return False
if (isinstance(node, (nodes.enumerated_list, nodes.bullet_list))
and not self.settings.compact_lists):
# print "`compact-lists` is False"
return False
# more special cases:
if (self.topic_classes == ['contents']): # TODO: self.in_contents
return True
# check the list items:
return self.check_simple_list(node)
示例9: make_operation
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import bullet_list [as 别名]
def make_operation(self, path, operation):
swagger_node = swaggerdoc(path)
swagger_node += nodes.title(path, operation['method'].upper() + ' ' + path)
content = nodes.paragraph()
content += nodes.Text(operation['summary'])
bullet_list = nodes.bullet_list()
bullet_list += self.create_item('Notes: ', operation.get('notes', ''))
bullet_list += self.create_item('Consumes: ', self.expand_values(operation.get('consumes', '')))
bullet_list += self.create_item('Produces: ', self.expand_values(operation.get('produces', '')))
content += bullet_list
swagger_node += content
return [swagger_node]