• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python addnodes.desc_parameterlist函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sphinx.addnodes.desc_parameterlist函数的典型用法代码示例。如果您正苦于以下问题:Python desc_parameterlist函数的具体用法?Python desc_parameterlist怎么用?Python desc_parameterlist使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了desc_parameterlist函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: handle_signature

    def handle_signature(self, sig, signode):
        m = ks_sig_re.match(sig)
        name = m.group('object')

        current_struct = self.env.temp_data.get('ks:structure')
        if m.group('prefix') is None:
            if current_struct is not None:
                fullname = current_struct + ':' + name
        else:
            struct = m.group('prefix').split(':')[-1]
            fullname = struct + ':' + name

        if struct is not None:
            if struct != '':
                signode += addnodes.desc_type(struct,struct+':')

        signode += addnodes.desc_name(fullname, name)

        args = m.group('args')
        if args:
            signode += addnodes.desc_parameterlist(args,args)
        else:
            signode += addnodes.desc_parameterlist()


        return fullname
开发者ID:Blanks821,项目名称:KOS,代码行数:26,代码来源:ksdomain.py


示例2: add_sig_args

    def add_sig_args(self, signode, arglist, const):
        if not arglist:
            if self.sphinx_directive.objtype == 'function':
                # for functions, add an empty parameter list
                signode += addnodes.desc_parameterlist()
            if const:
                signode += addnodes.desc_addname(const, const)
            return 

        paramlist = addnodes.desc_parameterlist()
        arglist = arglist.replace('`', '').replace('\\ ', '') # remove markup
        # this messes up function pointer types, but not too badly ;)
        args = arglist.split(',')
        for arg in args:
            arg = arg.strip()
            param = addnodes.desc_parameter('', '', noemph=True)
            try:
                ctype, argname = arg.rsplit(' ', 1)
            except ValueError:
                # no argument name given, only the type
                self.add_cross_ref(param, arg)
            else:
                self.add_cross_ref(param, ctype)
                # separate by non-breaking space in the output
                param += nodes.emphasis(' '+argname, u'\xa0'+argname)
            paramlist += param
        signode += paramlist
        if const:
            signode += addnodes.desc_addname(const, const)
开发者ID:Cyofanni,项目名称:speect,代码行数:29,代码来源:c.py


示例3: handle_signature

    def handle_signature(self, sig, signode):
        m = ks_sig_re.match(sig)
        name = m.group('object')
        struct = None  #might override further down

        current_struct = self.env.temp_data.get('ks:structure')
        if m.group('prefix') is None:
            if current_struct is not None:
                struct = current_struct
                fullname = current_struct + ':' + name
            else:
                raise Exception("Method name lacks a prefix and isn't " +
                    "indented inside a structure section.  Problem " +
                    "occurred at " + self.env.docname + ", line " +
                     str(self.lineno) +
                     ".")
        else:
            struct = m.group('prefix').split(':')[-1]
            fullname = struct + ':' + name

        if struct is not None:
            if struct != '':
                signode += addnodes.desc_type(struct,struct+':')

        signode += addnodes.desc_name(fullname, name)

        args = m.group('args')
        if args:
            signode += addnodes.desc_parameterlist(args,args)
        else:
            signode += addnodes.desc_parameterlist()


        return fullname
开发者ID:KSP-KOS,项目名称:KOS,代码行数:34,代码来源:ksdomain.py


示例4: handle_signature

    def handle_signature(self, sig, signode):
        """Transform a C signature into RST nodes."""
        # first try the function pointer signature regex, it's more specific
        m = c_funcptr_sig_re.match(sig)
        if m is None:
            m = c_sig_re.match(sig)
        if m is None:
            raise ValueError('no match')
        rettype, name, arglist, const = m.groups()

        signode += addnodes.desc_type('', '')
        self._parse_type(signode[-1], rettype)
        try:
            classname, funcname = name.split('::', 1)
            classname += '::'
            signode += addnodes.desc_addname(classname, classname)
            signode += addnodes.desc_name(funcname, funcname)
            # name (the full name) is still both parts
        except ValueError:
            signode += addnodes.desc_name(name, name)
        # clean up parentheses from canonical name
        m = c_funcptr_name_re.match(name)
        if m:
            name = m.group(1)

        typename = self.env.temp_data.get('c:type')
        if self.name == 'c:member' and typename:
            fullname = typename + '.' + name
        else:
            fullname = name

        if not arglist:
            if self.objtype == 'function':
                # for functions, add an empty parameter list
                signode += addnodes.desc_parameterlist()
            if const:
                signode += addnodes.desc_addname(const, const)
            return fullname

        paramlist = addnodes.desc_parameterlist()
        arglist = arglist.replace('`', '').replace('\\ ', '') # remove markup
        # this messes up function pointer types, but not too badly ;)
        args = arglist.split(',')
        for arg in args:
            arg = arg.strip()
            param = addnodes.desc_parameter('', '', noemph=True)
            try:
                ctype, argname = arg.rsplit(' ', 1)
            except ValueError:
                # no argument name given, only the type
                self._parse_type(param, arg)
            else:
                self._parse_type(param, ctype)
                # separate by non-breaking space in the output
                param += nodes.emphasis(' '+argname, u'\xa0'+argname)
            paramlist += param
        signode += paramlist
        if const:
            signode += addnodes.desc_addname(const, const)
        return fullname
开发者ID:Scalr,项目名称:sphinx,代码行数:60,代码来源:c.py


示例5: handle_signature

    def handle_signature(self, sig, signode):
        """
        Transform a CFEngine 3 signature into RST nodes.
        """
        sig_d = {}
        m = cf3_sig_re.match(sig)
        try:
            sig_d['type'], sig_d['ns'], sig_d['id'], sig_d['args'] = m.groups()
        except AttributeError:
            raise ValueError

        sig_d['ns'] = sig_d['ns'] or self.options.get(
            'namespace', self.env.temp_data.get('cf3:namespace')
        )
        fullname = []
        fn_app   = fullname.append
        fn_app(self.objtype + _FN_SEP)
        if self.objtype in ('body', 'bundle'):
            tnode  = addnodes.desc_type('', '')
            tnode += nodes.Text(self.objtype + _SP, self.objtype)

            try:
                sig_d['type'] = sig_d['type'].strip()
                tnode += nodes.Text(sig_d['type'] + _SP, sig_d['type'])
                fn_app(sig_d['type'] + _FN_SEP)
            except AttributeError:
                self.state_machine.reporter.warning(
                    'invalid %s definition: %s' % (self.objtype, sig),
                    line=self.lineno
                )
            signode += tnode

        if sig_d['ns'] and sig_d['ns'] != 'default' \
            and self.env.config.add_module_names:
            signode += addnodes.desc_addname(
                sig_d['ns'], sig_d['ns'] + _NS_SEP
            )
        signode += addnodes.desc_name(sig_d['id'], sig_d['id'])
        fn_app(sig_d['id'])

        signode['namespace'] = sig_d['ns']
        signode['fullname']  = ''.join(fullname)

        if self.objtype == 'class':
            signode += addnodes.desc_name(_CL_MRK, _CL_MRK)
            return ''.join(fullname), sig_d['ns']

        if not sig_d['args'] and self.objtype == 'function':
            signode += addnodes.desc_parameterlist()
            return ''.join(fullname), sig_d['ns']

        if sig_d['args']:
            paramlist = addnodes.desc_parameterlist()
            for arg in sig_d['args'].split(','):
                arg = arg.strip()
                paramlist += addnodes.desc_parameter(arg, arg)
            signode += paramlist

        return ''.join(fullname), sig_d['ns']
开发者ID:Lemma1,项目名称:MINAMI,代码行数:59,代码来源:cf3domain.py


示例6: parse_c_signature

def parse_c_signature(signode, sig, desctype):
    """Transform a C (or C++) signature into RST nodes."""
    # first try the function pointer signature regex, it's more specific
    m = c_funcptr_sig_re.match(sig)
    if m is None:
        m = c_sig_re.match(sig)
    if m is None:
        raise ValueError('no match')
    rettype, name, arglist, const = m.groups()

    signode += addnodes.desc_type('', '')
    parse_c_type(signode[-1], rettype)
    try:
        classname, funcname = name.split('::', 1)
        classname += '::'
        signode += addnodes.desc_addname(classname, classname)
        signode += addnodes.desc_name(funcname, funcname)
        # name (the full name) is still both parts
    except ValueError:
        signode += addnodes.desc_name(name, name)
    # clean up parentheses from canonical name
    m = c_funcptr_name_re.match(name)
    if m:
        name = m.group(1)
    if not arglist:
        if desctype == 'cfunction':
            # for functions, add an empty parameter list
            signode += addnodes.desc_parameterlist()
        return name

    paramlist = addnodes.desc_parameterlist()
    arglist = arglist.replace('`', '').replace('\\ ', '') # remove markup
    # this messes up function pointer types, but not too badly ;)
    args = arglist.split(',')
    for arg in args:
        arg = arg.strip()
        param = addnodes.desc_parameter('', '', noemph=True)
        try:
            ctype, argname = arg.rsplit(' ', 1)
        except ValueError:
            # no argument name given, only the type
            parse_c_type(param, arg)
        else:
            parse_c_type(param, ctype)
            param += nodes.emphasis(' '+argname, ' '+argname)
        paramlist += param
    signode += paramlist
    if const:
        signode += addnodes.desc_addname(const, const)
    return name
开发者ID:fedor4ever,项目名称:linux_build,代码行数:50,代码来源:desc.py


示例7: _handle_function_signature

    def _handle_function_signature(self, sig, signode):
        m = ada_func_sig_re.match(sig)
        if m is None:
            print "m did not match the function"
            raise ValueError

        modname, name, dummy, arglist, returntype, abstract = m.groups()
        print "DEBUG: modname %s name %s arglist %s" % (modname, name, arglist)

        fullname = self._resolve_module_name(signode, modname, name)
        print "DEBUG: fullname %s" % fullname

        if not arglist:
            if self.needs_arglist():
                # for functions and procedures, add an empty parameter list
                new_node = addnodes.desc_parameterlist()
                new_node.child_text_separator = '; '
                signode += new_node
            if returntype:
                signode += addnodes.desc_returns(returntype, returntype)
            return fullname

        signode += nodes.Text(' ')

        new_node = addnodes.desc_parameterlist()
        new_node.child_text_separator = '; '
        signode += new_node

        stack = [signode[-1]]
        counters = [0, 0]
        for token in string.split(arglist, ';'):
            pieces = string.split(token, ':')
            name = pieces[0].strip()
            stack[-1] += addnodes.desc_parameter(name, name + " : " + pieces[1].strip())

            if len(stack) == 1:
                counters[0] += 1
            else:
                counters[1] += 1

        if len(stack) != 1:
            raise ValueError
        if not counters[1]:
            fullname = '%s/%d' % (fullname, counters[0])
        else:
            fullname = '%s/%d..%d' % (fullname, counters[0], sum(counters))
        if returntype:
            signode += addnodes.desc_returns(returntype,returntype)
        return fullname
开发者ID:capnrefsmmat,项目名称:sphinx-contrib,代码行数:49,代码来源:adadomain.py


示例8: _handle_function_signature

    def _handle_function_signature(self, sig, signode):
        m = erl_func_sig_re.match(sig)
        if m is None:
            raise ValueError
        modname, name, arglist, retann = m.groups()

        fullname = self._resolve_module_name(signode, modname, name)

        if not arglist:
            if self.needs_arglist():
                # for callables, add an empty parameter list
                signode += addnodes.desc_parameterlist()
            if retann:
                signode += addnodes.desc_returns(retann, retann)
            if self.objtype == 'function':
                return fullname + '/0'
            return fullname
        signode += addnodes.desc_parameterlist()

        stack = [signode[-1]]
        counters = [0, 0]
        for token in erl_paramlist_re.split(arglist):
            if token == '[':
                opt = addnodes.desc_optional()
                stack[-1] += opt
                stack.append(opt)
            elif token == ']':
                try:
                    stack.pop()
                except IndexError:
                    raise ValueError
            elif not token or token == ',' or token.isspace():
                pass
            else:
                token = token.strip()
                stack[-1] += addnodes.desc_parameter(token, token)
                if len(stack) == 1:
                    counters[0] += 1
                else:
                    counters[1] += 1
        if len(stack) != 1:
            raise ValueError
        if not counters[1]:
            fullname = '%s/%d' % (fullname, counters[0])
        else:
            fullname = '%s/%d..%d' % (fullname, counters[0], sum(counters))
        if retann:
            signode += addnodes.desc_returns(retann, retann)
        return fullname
开发者ID:Lemma1,项目名称:MINAMI,代码行数:49,代码来源:erlangdomain.py


示例9: make_parameters

    def make_parameters(self):
        params = addnodes.desc_parameterlist('', '')
        ctor = self.item.constructor
        if ctor:
            params += make_desc_parameters(ctor.params)

        return params
开发者ID:xmo-odoo,项目名称:odoo,代码行数:7,代码来源:directives.py


示例10: handle_signature

 def handle_signature(self, sig, signode):
     method = self.method.upper() + ' '
     signode += addnodes.desc_name(method, method)
     offset = 0
     path = None
     for match in http_sig_param_re.finditer(sig):
         path = sig[offset:match.start()]
         signode += addnodes.desc_name(path, path)
         params = addnodes.desc_parameterlist()
         typ = match.group('type')
         if typ:
             typ += ': '
             params += addnodes.desc_annotation(typ, typ)
         name = match.group('name')
         params += addnodes.desc_parameter(name, name)
         signode += params
         offset = match.end()
     if offset < len(sig):
         path = sig[offset:len(sig)]
         signode += addnodes.desc_name(path, path)
     assert path is not None, 'no matches for sig: %s' % sig
     fullname = self.method.upper() + ' ' + path
     signode['method'] = self.method
     signode['path'] = sig
     signode['fullname'] = fullname
     return (fullname, self.method, sig)
开发者ID:felipeblassioli,项目名称:sphinx_autoflask,代码行数:26,代码来源:httpdomain.py


示例11: handle_signature

 def handle_signature(self, sig, signode):
     """Handle IDL signature lines"""
     m = idl_sig_re.match(sig)
     if not m:
         self.env.app.warn("Signature did not match for {}".format(sig))
         raise ValueError("Signature did not match!")
     pro_or_function, name, arglist = m.groups()
     
     # Add a prefix for function/program
     if self.display_prefix:
         signode += addnodes.desc_annotation(self.display_prefix,
                                             self.display_prefix)
     
     signode += addnodes.desc_annotation(self.objtype, self.objtype)
     
     # Register the full name of the program
     signode['fullname'] = name
     signode += addnodes.desc_name(name, name)
     
     # Parse the argument list from the signature
     if not arglist and self.objtype == 'function':
         signode += addnodes.desc_parameterlist()
     elif arglist:
         _pseudo_parse_arglist(signode, arglist)
     return (name, '')
开发者ID:alexrudy,项目名称:sphinx-idl,代码行数:25,代码来源:domain.py


示例12: handle_signature

    def handle_signature(self, sig, signode):
        cache = _APP_CACHES.get(self.env.app, {})
        key = CursorKind.MACRO_DEFINITION, (sig, )
        if key in cache:
            node, comment, start, end, _ = cache[key]
            signode += addnodes.desc_name(node.displayname, node.displayname)

            # There is unfortunately no API to get the parameters of a macro,
            # so we identify them by looking at the tokens.
            tokens = list(node.get_tokens())
            if (
                tokens[1].kind is TokenKind.PUNCTUATION and
                tokens[1].spelling == '('
            ):
                paramlist = addnodes.desc_parameterlist()
                for token in tokens[2:]:
                    if (
                        token.kind is TokenKind.PUNCTUATION and
                        token.spelling == ')'
                    ):
                        break
                    elif token.kind is TokenKind.IDENTIFIER:
                        paramlist += addnodes.desc_parameter(token.spelling, token.spelling)
                signode += paramlist

            self.content = ViewList()
            for lineno, line in enumerate(comment.splitlines(), start[0]):
                self.content.append(line, '<unknown>', lineno)
        return sig
开发者ID:DasIch,项目名称:autodoc-c,代码行数:29,代码来源:__init__.py


示例13: handle_constructor_signature

    def handle_constructor_signature(self, sig, signode):
        try:
            member = javalang.parse.parse_constructor_signature(sig)
        except javalang.parser.JavaSyntaxError:
            raise self.error("syntax error in constructor signature")

        if not isinstance(member, javalang.tree.ConstructorDeclaration):
            raise self.error("expected constructor declaration")

        mods = formatter.output_modifiers(member.modifiers).build()
        signode += nodes.Text(mods + ' ', mods + ' ')

        signode += addnodes.desc_name(member.name, member.name)

        paramlist = addnodes.desc_parameterlist()
        for parameter in member.parameters:
            param = addnodes.desc_parameter('', '', noemph=True)
            param += self._build_type_node(parameter.type)

            if parameter.varargs:
                param += nodes.Text('...', '')

            param += nodes.emphasis(' ' + parameter.name, ' ' + parameter.name)
            paramlist += param
        signode += paramlist

        param_reprs = [formatter.output_type(param.type, with_generics=False).build() for param in member.parameters]
        return '%s(%s)' % (member.name, ', '.join(param_reprs))
开发者ID:bronto,项目名称:javasphinx,代码行数:28,代码来源:domain.py


示例14: run

  def run(self):
    #no good
    # node = nodes.paragraph('', 'Hi there!',
    #   ids=['foo'],
    #   names = ['foobar']
    # )

    #works
    # node = nodes.section(names=['foobar'])
    # self.state.document.note_explicit_target(node)
    # node.append(nodes.paragraph('', "foo foo"))
    
    #no good
    # node = nodes.admonition(names=['foobar'])
    # self.state.document.note_explicit_target(node)
    # node.append(nodes.paragraph('', "foo foo"))

    # node = nodes.paragraph('', 'foo foo', names=['foobar'])
    # self.state.document.note_explicit_target(node)

    #This doesn't properly render
    desc = addnodes.desc('',
      addnodes.desc_signature('',
        addnodes.desc_name('', 'namename'),
        addnodes.desc_parameterlist('',
          addnodes.desc_parameter('', 'def')
        ),
      names=['namename'], fullname="namename", ids=['namename'], module=None, first=False),
    desctype="function", domain="py", objtype='objtype')
    
    #no link (because didn't properly render?)
    self.state.document.note_explicit_target(desc)
    return [desc]
开发者ID:maxrothman,项目名称:sphinx-test,代码行数:33,代码来源:directives.py


示例15: lua_desc_parameterlist

def lua_desc_parameterlist(argstart, argend):
    node = addnodes.desc_parameterlist()
    node.param_start = argstart
    node.param_end = argend
    if argstart == "{":
        node.param_class = "brace"
    return node
开发者ID:jd28,项目名称:sphinx-lua,代码行数:7,代码来源:lua.py


示例16: handle_signature

    def handle_signature(self, sig, signode):
        m = sig_pattern.match(sig)
        if m is None:
            raise ValueError()
        return_type, method_name, arglist = m.groups()

        arguments = []
        if arglist:
            for arg in arglist.split(","):
                m = arg_pattern.match(arg)
                if m is None:
                    raise ValueError()
                arguments.append(m.groups())

        class_name = self.env.temp_data.get("java:class")
        if not class_name:
            self.env.warn(
                self.env.docname, "Java method description of %s outside of class is not supported" % sig, self.lineno
            )
            raise ValueError()

        if return_type is not None:  # will be absent for constructors
            self._parse_type(return_type, signode)
        signode += nodes.Text(" ", " ")
        signode += addnodes.desc_name(method_name, method_name)
        signode += addnodes.desc_parameterlist()
        for type, name in arguments:
            signode[-1] += addnodes.desc_parameter("", "", noemph=True)
            self._parse_type(type, signode[-1][-1])
            signode[-1][-1] += nodes.Text(" ", " ")
            signode[-1][-1] += nodes.emphasis(name, name)

        return "%s#%s(%s)" % (class_name, method_name, ", ".join(type for type, name in arguments))
开发者ID:rogerbinns,项目名称:jia-mini-python,代码行数:33,代码来源:javadomain.py


示例17: attach_function

    def attach_function(self, node, func):
        owner, name = func.name.split_owner()
        # Olaf: Never show Class::
        owner = None
        if owner is not None:
            owner = unicode(owner) + '::'
            node += addnodes.desc_addname(owner, owner)

        # cast operator is special.  in this case the return value
        # is reversed.
        if isinstance(name, CastOpDefExpr):
            node += addnodes.desc_name('operator', 'operator')
            node += nodes.Text(u' ')
            self.attach_type(node, name.typename)
        else:
            funcname = unicode(name)
            node += addnodes.desc_name(funcname, funcname)

        paramlist = addnodes.desc_parameterlist()
        for arg in func.signature:
            param = addnodes.desc_parameter('', '', noemph=True)
            if arg.type is not None:
                self.attach_type(param, arg.type)
                param += nodes.Text(u' ')
            param += nodes.emphasis(unicode(arg.name), unicode(arg.name))
            if arg.default is not None:
                def_ = u'=' + unicode(arg.default)
                param += nodes.emphasis(def_, def_)
            paramlist += param

        node += paramlist
        if func.const:
            node += addnodes.desc_addname(' const', ' const')
        if func.pure_virtual:
            node += addnodes.desc_addname(' = 0', ' = 0')
开发者ID:flyeven,项目名称:doc,代码行数:35,代码来源:matlabdomain.py


示例18: handle_signature

 def handle_signature(self, sig, signode):
     method = self.method.upper() + " "
     signode += addnodes.desc_name(method, method)
     offset = 0
     path = None
     for match in http_sig_param_re.finditer(sig):
         path = sig[offset : match.start()]
         signode += addnodes.desc_name(path, path)
         params = addnodes.desc_parameterlist()
         typ = match.group("type")
         if typ:
             typ += ": "
             params += addnodes.desc_annotation(typ, typ)
         name = match.group("name")
         params += addnodes.desc_parameter(name, name)
         signode += params
         offset = match.end()
     if offset < len(sig):
         path = sig[offset : len(sig)]
         signode += addnodes.desc_name(path, path)
     if path is None:
         assert False, "no matches for sig: %s" % sig
     fullname = self.method.upper() + " " + path
     signode["method"] = self.method
     signode["path"] = sig
     signode["fullname"] = fullname
     return (fullname, self.method, sig)
开发者ID:apache,项目名称:couchdb-documentation,代码行数:27,代码来源:httpdomain.py


示例19: _pseudo_parse_arglist

def _pseudo_parse_arglist(signode, arglist):
    # type: (addnodes.desc_signature, str) -> None
    """"Parse" a list of arguments separated by commas.

    Arguments can have "optional" annotations given by enclosing them in
    brackets.  Currently, this will split at any comma, even if it's inside a
    string literal (e.g. default argument value).
    """
    paramlist = addnodes.desc_parameterlist()
    stack = [paramlist]  # type: List[nodes.Element]
    try:
        for argument in arglist.split(','):
            argument = argument.strip()
            ends_open = ends_close = 0
            while argument.startswith('['):
                stack.append(addnodes.desc_optional())
                stack[-2] += stack[-1]
                argument = argument[1:].strip()
            while argument.startswith(']'):
                stack.pop()
                argument = argument[1:].strip()
            while argument.endswith(']') and not argument.endswith('[]'):
                ends_close += 1
                argument = argument[:-1].strip()
            while argument.endswith('['):
                ends_open += 1
                argument = argument[:-1].strip()
            if argument:
                stack[-1] += addnodes.desc_parameter(argument, argument)
            while ends_open:
                stack.append(addnodes.desc_optional())
                stack[-2] += stack[-1]
                ends_open -= 1
            while ends_close:
                stack.pop()
                ends_close -= 1
        if len(stack) != 1:
            raise IndexError
    except IndexError:
        # if there are too few or too many elements on the stack, just give up
        # and treat the whole argument list as one argument, discarding the
        # already partially populated paramlist node
        paramlist = addnodes.desc_parameterlist()
        paramlist += addnodes.desc_parameter(arglist, arglist)
        signode += paramlist
    else:
        signode += paramlist
开发者ID:lmregus,项目名称:Portfolio,代码行数:47,代码来源:python.py


示例20: handle_signature

	def handle_signature(self, sig, signode):
		sig = sig.strip()
		if '(' in sig and sig[-1:] == ')':
			prefix, arglist = sig.split('(', 1)
			prefix = prefix.strip()
			arglist = arglist[:-1].strip()
		else:
			prefix = sig
			arglist = None
		if '.' in prefix:
			nameprefix, name = prefix.rsplit('.', 1)
		else:
			nameprefix = None
			name = prefix

		objectname = self.env.temp_data.get('js:object')
		if nameprefix:
		 	if objectname:
				# someone documenting the method of an attribute
				# of the current object? shouldn't happen but
				# who knows...
				nameprefix = objectname + '.' + nameprefix
			fullname = nameprefix + '.' + name

		elif objectname:
			fullname = objectname + '.' + name

		else:
			# just a function or constructor
			objectname = ''
			fullname = name

		signode['object'] = objectname
		signode['fullname'] = fullname

		if self.display_prefix:
			signode += addnodes.desc_annotation(self.display_prefix,
				self.display_prefix)

		if nameprefix:
			 signode += addnodes.desc_addname(nameprefix + '.',
				nameprefix + '.')
		signode += addnodes.desc_name(name, name)
		if self.has_arguments:
			if not arglist:
				signode += addnodes.desc_parameterlist()
			else:
				_pseudo_parse_arglist(signode, arglist)

		class_name = self.options.get('outertype')
		# object belongs to some class or namespace
		if class_name:
			# func_desc = function return type + function name
			func_desc = fullname.split(' ', 1)
			if len(func_desc) > 1:
				fullname = func_desc[0] + ' ' + class_name +\
					'.' + func_desc[1]

		return fullname, nameprefix
开发者ID:povilasb,项目名称:sphinx-js-domain,代码行数:59,代码来源:javascript.py



注:本文中的sphinx.addnodes.desc_parameterlist函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python addnodes.desc_returns函数代码示例发布时间:2022-05-27
下一篇:
Python addnodes.desc_parameter函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap