本文整理汇总了Python中docutils.nodes.strong方法的典型用法代码示例。如果您正苦于以下问题:Python nodes.strong方法的具体用法?Python nodes.strong怎么用?Python nodes.strong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类docutils.nodes
的用法示例。
在下文中一共展示了nodes.strong方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _format_subcommands
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import strong [as 别名]
def _format_subcommands(self, parser_info):
assert 'children' in parser_info
items = []
for subcmd in parser_info['children']:
subcmd_items = []
if subcmd['help']:
subcmd_items.append(nodes.paragraph(text=subcmd['help']))
else:
subcmd_items.append(nodes.paragraph(text='Undocumented'))
items.append(
nodes.definition_list_item(
'',
nodes.term('', '', nodes.strong(
text=subcmd['bare_usage'])),
nodes.definition('', *subcmd_items)))
return nodes.definition_list('', *items)
示例2: run
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import strong [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]
示例3: http_header_role
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import strong [as 别名]
def http_header_role(name, rawtext, text, lineno, inliner, options=None, content=None):
if options is None:
options = {}
if content is None:
content = []
header = str(text)
if header not in HEADER_REFS:
header = header.title()
if header not in HEADER_REFS:
if header.startswith(("X-Couch-", "Couch-")):
return [nodes.strong(header, header)], []
msg = inliner.reporter.error(
"%s is not unknown HTTP header" % header, lineno=lineno
)
prb = inliner.problematic(rawtext, rawtext, msg)
return [prb], [msg]
url = str(HEADER_REFS[header])
node = nodes.reference(rawtext, header, refuri=url, **options)
return [node], []
示例4: make_parameters
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import strong [as 别名]
def make_parameters(self, parameters):
entries = []
head = ['Name', 'Position', 'Description', 'Type']
body = []
for param in parameters:
row = []
row.append(param.get('name', ''))
row.append(param.get('in', ''))
row.append(param.get('description', ''))
row.append(param.get('type', ''))
body.append(row)
table = self.create_table(head, body)
paragraph = nodes.paragraph()
paragraph += nodes.strong('', 'Parameters')
entries.append(paragraph)
entries.append(table)
return entries
示例5: test_caption_option2
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import strong [as 别名]
def test_caption_option2(self):
directives.setup(format='SVG', outputdir=self.tmpdir)
text = (".. blockdiag::\n"
" :caption: **hello** *world*\n"
"\n"
" A -> B")
doctree = publish_doctree(text)
self.assertEqual(1, len(doctree))
self.assertEqual(nodes.figure, type(doctree[0]))
self.assertEqual(2, len(doctree[0]))
self.assertEqual(nodes.image, type(doctree[0][0]))
self.assertEqual(nodes.caption, type(doctree[0][1]))
self.assertEqual(3, len(doctree[0][1]))
self.assertEqual(nodes.strong, type(doctree[0][1][0]))
self.assertEqual('hello', doctree[0][1][0][0])
self.assertEqual(nodes.Text, type(doctree[0][1][1]))
self.assertEqual(' ', doctree[0][1][1][0])
self.assertEqual(nodes.emphasis, type(doctree[0][1][2]))
self.assertEqual('world', doctree[0][1][2][0])
示例6: visit_productionlist
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import strong [as 别名]
def visit_productionlist(self, node):
replacement = nodes.literal_block(classes=["code"])
names = []
for production in node:
names.append(production['tokenname'])
maxlen = max(len(name) for name in names)
for production in node:
if production['tokenname']:
lastname = production['tokenname'].ljust(maxlen)
n = nodes.strong()
n += nodes.Text(lastname)
replacement += n
replacement += nodes.Text(' ::= ')
else:
replacement += nodes.Text('%s ' % (' ' * len(lastname)))
production.walkabout(self)
replacement.children.extend(production.children)
replacement += nodes.Text('\n')
node.parent.replace(node, replacement)
raise nodes.SkipNode
示例7: strong
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import strong [as 别名]
def strong(self, match, lineno):
before, inlines, remaining, sysmessages, endstring = self.inline_obj(
match, lineno, self.patterns.strong, nodes.strong)
return before, inlines, remaining, sysmessages
示例8: print_subcommand_list
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import strong [as 别名]
def print_subcommand_list(data, nested_content):
definitions = map_nested_definitions(nested_content)
items = []
if 'children' in data:
for child in data['children']:
my_def = [nodes.paragraph(
text=child['help'])] if child['help'] else []
name = child['name']
my_def = apply_definition(definitions, my_def, name)
if len(my_def) == 0:
my_def.append(nodes.paragraph(text='Undocumented'))
if 'description' in child:
my_def.append(nodes.paragraph(text=child['description']))
my_def.append(nodes.literal_block(text=child['usage']))
my_def.append(print_command_args_and_opts(
print_arg_list(child, nested_content),
print_opt_list(child, nested_content),
print_subcommand_list(child, nested_content)
))
items.append(
nodes.definition_list_item(
'',
nodes.term('', '', nodes.strong(text=name)),
nodes.definition('', *my_def)
)
)
return nodes.definition_list('', *items)
示例9: create_item
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import strong [as 别名]
def create_item(self, key, value):
para = nodes.paragraph()
para += nodes.strong('', key)
para += nodes.Text(value)
item = nodes.list_item()
item += para
return item
示例10: make_responses
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import strong [as 别名]
def make_responses(self, responses):
# Create an entry with swagger responses and a table of the response properties
entries = []
paragraph = nodes.paragraph()
paragraph += nodes.strong('', 'Responses')
entries.append(paragraph)
head = ['Name', 'Description', 'Type']
for response_name, response in responses.items():
paragraph = nodes.paragraph()
paragraph += nodes.emphasis('', '%s - %s' % (response_name,
response.get('description', '')))
entries.append(paragraph)
body = []
# if the optional field properties is in the schema, display the properties
if isinstance(response.get('schema'), dict) and 'properties' in response.get('schema'):
for property_name, property in response.get('schema').get('properties', {}).items():
row = []
row.append(property_name)
row.append(property.get('description', ''))
row.append(property.get('type', ''))
body.append(row)
table = self.create_table(head, body)
entries.append(table)
return entries
示例11: run
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import strong [as 别名]
def run(self):
self.reporter = self.state.document.reporter
api_url = self.content[0]
if len(self.content) > 1:
selected_tags = self.content[1:]
else:
selected_tags = []
try:
api_desc = self.processSwaggerURL(api_url)
groups = self.group_tags(api_desc)
self.check_tags(selected_tags, groups.keys(), api_url)
entries = []
for tag_name, methods in groups.items():
if tag_name in selected_tags or len(selected_tags) == 0:
section = self.create_section(tag_name)
for path, method_type, method in methods:
section += self.make_method(path, method_type, method)
entries.append(section)
return entries
except Exception as e:
error_message = 'Unable to process URL: %s' % api_url
print(error_message)
traceback.print_exc()
error = nodes.error('')
para_error = nodes.paragraph()
para_error += nodes.Text(error_message + '. Please check that the URL is a valid Swagger api-docs URL and it is accesible')
para_error_detailed = nodes.paragraph()
para_error_detailed = nodes.strong('Processing error. See console output for a more detailed error')
error += para_error
error += para_error_detailed
return [error]
示例12: run
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import strong [as 别名]
def run(self):
self.assert_has_content()
num = self.env.new_serialno(self.node_class_str)
target_id = f"{self.node_class_str}-{num:d}"
targetnode = nodes.target('', '', ids=[target_id])
_path = self.env.docname.replace("/", "-")
node_id = f"{_path}-{num}"
node = self.node_class("\n".join(self.content))
node["_id"] = node_id
node["classes"] = [self.options.get("class", None)]
node["label"] = self.options.get("label", None)
title_root = self.options.get("title", self.title_root)
node["title_root"] = title_root
title = _(f"{title_root} {num + 1}")
para = nodes.paragraph()
para += nodes.strong(title, title)
node += para
self.state.nested_parse(self.content, self.content_offset, node)
if not hasattr(self.env, self.env_attr):
setattr(self.env, self.env_attr, dict())
getattr(self.env, self.env_attr)[node_id] = {
'docname': self.env.docname,
'lineno': self.lineno,
'node_copy': node.deepcopy(),
'target': targetnode,
"number": num,
"label": node["label"],
"title_root": title_root,
}
return [targetnode, node]
示例13: visit_strong
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import strong [as 别名]
def visit_strong(self, _):
n = nodes.strong()
self.current_node.append(n)
self.current_node = n
示例14: _create_list_item
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import strong [as 别名]
def _create_list_item(self, str):
"""Creates a new list item
:returns: List item node
"""
para = nodes.paragraph()
para += nodes.strong('', str)
item = nodes.list_item()
item += para
return item
示例15: role_ftype
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import strong [as 别名]
def role_ftype(name, rawtext, text, lineno, inliner, options=None, content=()):
options = options or {}
node = nodes.strong(text, text)
assert text.count('(') in (0, 1)
assert text.count('(') == text.count(')')
assert ')' not in text or text.endswith(')')
match = re.search(r'\((.*?)\)', text)
node['ids'] = [match.group(1) if match else text]
return [node], []