當前位置: 首頁>>代碼示例>>Python>>正文


Python nodes.strong方法代碼示例

本文整理匯總了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) 
開發者ID:rucio,項目名稱:rucio,代碼行數:18,代碼來源:ext.py

示例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] 
開發者ID:EMVA1288,項目名稱:emva1288,代碼行數:18,代碼來源:sphinx_directives.py

示例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], [] 
開發者ID:apache,項目名稱:couchdb-documentation,代碼行數:21,代碼來源:httpdomain.py

示例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 
開發者ID:unaguil,項目名稱:sphinx-swaggerdoc,代碼行數:25,代碼來源:swaggerv2_doc.py

示例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]) 
開發者ID:blockdiag,項目名稱:blockdiag,代碼行數:21,代碼來源:test_blockdiag_directives.py

示例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 
開發者ID:rst2pdf,項目名稱:rst2pdf,代碼行數:22,代碼來源:pdfbuilder.py

示例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 
開發者ID:skarlekar,項目名稱:faces,代碼行數:6,代碼來源:states.py

示例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) 
開發者ID:pnnl,項目名稱:safekit,代碼行數:29,代碼來源:ext.py

示例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 
開發者ID:unaguil,項目名稱:sphinx-swaggerdoc,代碼行數:11,代碼來源:swaggerv2_doc.py

示例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 
開發者ID:unaguil,項目名稱:sphinx-swaggerdoc,代碼行數:32,代碼來源:swaggerv2_doc.py

示例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] 
開發者ID:unaguil,項目名稱:sphinx-swaggerdoc,代碼行數:43,代碼來源:swaggerv2_doc.py

示例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] 
開發者ID:QuantEcon,項目名稱:sphinxcontrib-jupyter,代碼行數:39,代碼來源:exercise.py

示例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 
開發者ID:readthedocs,項目名稱:recommonmark,代碼行數:6,代碼來源:parser.py

示例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 
開發者ID:openstack,項目名稱:senlin,代碼行數:14,代碼來源:resources.py

示例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], [] 
開發者ID:landlab,項目名稱:landlab,代碼行數:11,代碼來源:landlab_ext.py


注:本文中的docutils.nodes.strong方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。