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


Python addnodes.desc_addname方法代碼示例

本文整理匯總了Python中sphinx.addnodes.desc_addname方法的典型用法代碼示例。如果您正苦於以下問題:Python addnodes.desc_addname方法的具體用法?Python addnodes.desc_addname怎麽用?Python addnodes.desc_addname使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sphinx.addnodes的用法示例。


在下文中一共展示了addnodes.desc_addname方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: handle_signature

# 需要導入模塊: from sphinx import addnodes [as 別名]
# 或者: from sphinx.addnodes import desc_addname [as 別名]
def handle_signature(self, sig, signode):
        name = sig
        config = self.options.get('config', self.env.ref_context.get('cfg:config', ""))
        if not config:
            logger.warning("config option with unknown config", location=signode)
            config = "UNKNOWN"
        fullname = config + '.' + name

        signode += addnodes.desc_annotation('option ', 'option ')
        if not self.env.ref_context.get('cfg:in-config', False):
            signode += addnodes.pending_xref(sig,
                                             addnodes.desc_addname(config, config),
                                             refdomain='cfg',
                                             reftype='config',
                                             reftarget=config)
            signode += addnodes.desc_addname('', '.')

        signode += addnodes.desc_name(sig, '', nodes.Text(sig))

        typ = self.options.get('type')
        if typ:
            type_node = addnodes.desc_annotation(': ', ': ')
            info = self.content.parent.info(1)  # might be off by a few lines...
            type_node.extend(_parse_inline(self.state, typ, info))
            signode += type_node

        defaultvalue = self.options.get('default')
        if defaultvalue:
            val_node = addnodes.desc_annotation(' = ', ' = ')
            val_node += nodes.literal(defaultvalue, defaultvalue)
            signode += val_node

        return fullname, config 
開發者ID:tenpy,項目名稱:tenpy,代碼行數:35,代碼來源:sphinx_cfg_options.py

示例2: handle_signature

# 需要導入模塊: from sphinx import addnodes [as 別名]
# 或者: from sphinx.addnodes import desc_addname [as 別名]
def handle_signature(self, sig, signode):
        signode += addnodes.desc_addname(sig, sig)
        return sig 
開發者ID:Azure,項目名稱:azure-cli-dev-tools,代碼行數:5,代碼來源:directives.py

示例3: append_indexer_parameters

# 需要導入模塊: from sphinx import addnodes [as 別名]
# 或者: from sphinx.addnodes import desc_addname [as 別名]
def append_indexer_parameters(self, node, params):
        pnodes = addnodes.desc_addname()
        pnodes += nodes.Text('[')

        for param in params:
            if pnodes.children:
                pnodes += nodes.Text(u', ')

            self.append_type(pnodes, param.typ)
            pnodes += nodes.Text(u' ')
            pnodes += nodes.emphasis(param.name, param.name)

        pnodes += nodes.Text(']')
        node += pnodes 
開發者ID:djungelorm,項目名稱:sphinx-csharp,代碼行數:16,代碼來源:csharp.py

示例4: handle_signature

# 需要導入模塊: from sphinx import addnodes [as 別名]
# 或者: from sphinx.addnodes import desc_addname [as 別名]
def handle_signature(self, sig, signode):
        methods, path = sig
        signode += addnodes.desc_annotation('endpoint ', 'endpoint ')
        signode += addnodes.desc_addname(methods + ' ', methods + ' ')
        signode += addnodes.desc_name(path, path) 
開發者ID:mozilla,項目名稱:build-relengapi,代碼行數:7,代碼來源:apidoc.py

示例5: make_process_header

# 需要導入模塊: from sphinx import addnodes [as 別名]
# 或者: from sphinx.addnodes import desc_addname [as 別名]
def make_process_header(self, slug, typ, version, source_uri, description, inputs):
        """Generate a process definition header.

        :param str slug: process' slug
        :param str typ: process' type
        :param str version:  process' version
        :param str source_uri: url to the process definition
        :param str description: process' description
        :param dict inputs: process' inputs

        """
        node = addnodes.desc()
        signode = addnodes.desc_signature(slug, "")
        node.append(signode)

        node["objtype"] = node["desctype"] = typ

        signode += addnodes.desc_annotation(typ, typ, classes=["process-type"])
        signode += addnodes.desc_addname("", "")
        signode += addnodes.desc_name(slug + " ", slug + " ")

        paramlist = addnodes.desc_parameterlist()

        for field_schema, _, _ in iterate_schema({}, inputs, ""):
            field_type = field_schema["type"]
            field_name = field_schema["name"]

            field_default = field_schema.get("default", None)
            field_default = "" if field_default is None else "={}".format(field_default)

            param = addnodes.desc_parameter("", "", noemph=True)
            param += nodes.emphasis(field_type, field_type, classes=["process-type"])
            # separate by non-breaking space in the output
            param += nodes.strong(text="\xa0\xa0" + field_name)

            paramlist += param

        signode += paramlist
        signode += nodes.reference(
            "",
            nodes.Text("[Source: v{}]".format(version)),
            refuri=source_uri,
            classes=["viewcode-link"],
        )

        desc = nodes.paragraph()
        desc += nodes.Text(description, description)

        return [node, desc] 
開發者ID:genialis,項目名稱:resolwe,代碼行數:51,代碼來源:autoprocess.py


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