Python sphinx.addnodes.desc_addname() Examples
The following are 5
code examples of sphinx.addnodes.desc_addname().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
sphinx.addnodes
, or try the search function
.
Example #1
Source File: sphinx_cfg_options.py From tenpy with GNU General Public License v3.0 | 5 votes |
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
Example #2
Source File: directives.py From azure-cli-dev-tools with MIT License | 5 votes |
def handle_signature(self, sig, signode): signode += addnodes.desc_addname(sig, sig) return sig
Example #3
Source File: csharp.py From sphinx-csharp with MIT License | 5 votes |
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
Example #4
Source File: apidoc.py From build-relengapi with Mozilla Public License 2.0 | 5 votes |
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)
Example #5
Source File: autoprocess.py From resolwe with Apache License 2.0 | 4 votes |
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]