Classes de nós de doctree adicionadas pelo Sphinx¶
Nós para descrições de objetos específicos de domínio¶
Nós de nível superior¶
Esses nós formam os níveis mais altos de descrições de objetos.
- class sphinx.addnodes.desc(rawsource: str = '', *children, **attributes: Any)[código-fonte]¶
Nó para uma lista de assinaturas de objetos e uma descrição comum delas.
Contém um ou mais nós
desc_signaturee então um único nódesc_content.Este nó sempre possui duas classes:
O nome do domínio ao qual pertence, por exemplo,
pyoucpp.O nome do tipo de objeto no domínio, por exemplo,
function.
- class sphinx.addnodes.desc_signature(*args: Any, **kwargs: Any)[código-fonte]¶
Nó para uma assinatura de objeto único.
Por padrão, a assinatura é uma assinatura de linha única. Defina
is_multiline = Truepara descrever uma assinatura multilinha. Nesse caso, todos os nós filhos devem ser nósdesc_signature_line.Este nó sempre possui as classes
sig,sig-object, e o domínio ao qual pertence.
- class sphinx.addnodes.desc_signature_line(rawsource: str = '', text: str = '', *children, **attributes: Any)[código-fonte]¶
Node for a line in a multi-line object signature.
Ele só deve ser usado como filho de um
desc_signaturecomis_multilinedefinido comoTrue. Definaadd_permalink = Truepara a linha que deve obter o link permanente.
- class sphinx.addnodes.desc_content(rawsource: str = '', *children, **attributes: Any)[código-fonte]¶
Nó para conteúdo de descrição do objeto.
Deve ser o último nó filho em um nó
desc.
- class sphinx.addnodes.desc_inline(domain: str, *args: Any, **kwargs: Any)[código-fonte]¶
Nó para um fragmento de assinatura em texto embutido.
Isto é usado, por exemplo, para papéis como
cpp:expr.Este nó sempre possui as classes
sig,sig-inline, e o nome do domínio ao qual pertence.
Nós para estrutura de alto nível em assinaturas¶
Esses nós ocorrem em nós desc_signature não multilinhas e em nós desc_signature_line.
- class sphinx.addnodes.desc_name(*args: Any, **kwargs: Any)[código-fonte]¶
Nó para o nome do objeto principal.
Por exemplo, na declaração de uma classe Python
MyModule.MyClass, o nome principal éMyClass.Este nó sempre possui a classe
sig-name.
- class sphinx.addnodes.desc_addname(*args: Any, **kwargs: Any)[código-fonte]¶
Nó para partes de nome adicionais para um objeto.
Por exemplo, na declaração de uma classe Python
MyModule.MyClass, a parte adicional do nome éMyModule..Este nó sempre possui a classe
sig-prename.
- class sphinx.addnodes.desc_type(rawsource: str = '', text: str = '', *children, **attributes: Any)[código-fonte]¶
Nó para tipos de retorno ou nomes de tipos de objetos.
- class sphinx.addnodes.desc_returns(rawsource: str = '', text: str = '', *children, **attributes: Any)[código-fonte]¶
Nó para uma anotação de “returns” (a la -> em Python).
- class sphinx.addnodes.desc_parameterlist(rawsource: str = '', text: str = '', *children, **attributes: Any)[código-fonte]¶
Nó para uma lista geral de parâmetros.
As default the parameter list is written in line with the rest of the signature. Set
multi_line_parameter_list = Trueto describe a multi-line parameter list. In that case each parameter will then be written on its own, indented line. A trailing comma will be added on the last line ifmulti_line_trailing_commais True.
- class sphinx.addnodes.desc_parameter(rawsource: str = '', text: str = '', *children, **attributes: Any)[código-fonte]¶
Node for a single parameter.
- class sphinx.addnodes.desc_optional(rawsource: str = '', text: str = '', *children, **attributes: Any)[código-fonte]¶
Node for marking optional parts of the parameter list.
- class sphinx.addnodes.desc_annotation(rawsource: str = '', text: str = '', *children, **attributes: Any)[código-fonte]¶
Node for signature annotations (not Python 3-style annotations).
Nodes for signature text elements¶
These nodes inherit desc_sig_element and are generally translated
to docutils.nodes.inline by SigElementFallbackTransform.
Extensions may create additional desc_sig_*-like nodes but in order for
SigElementFallbackTransform to translate them to inline nodes
automatically, they must be added to SIG_ELEMENTS via the class
keyword argument _sig_element=True of desc_sig_element, e.g.:
class desc_custom_sig_node(desc_sig_element, _sig_element=True): ...
For backwards compatibility, it is still possible to add the nodes directly
using SIG_ELEMENTS.add(desc_custom_sig_node).
- sphinx.addnodes.SIG_ELEMENTS: set[type[desc_sig_element]]¶
A set of classes inheriting
desc_sig_element. Each node class is expected to be handled by the builder’s translator class if the latter does not inherit from SphinxTranslator.This set can be extended manually by third-party extensions or by subclassing
desc_sig_elementand using the class keyword argument _sig_element=True.
- class sphinx.addnodes.desc_sig_element(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[código-fonte]¶
Common parent class of nodes for inline text of a signature.
- class sphinx.addnodes.desc_sig_space(rawsource: str = '', text: str = ' ', *children: Element, **attributes: Any)[código-fonte]¶
Node for a space in a signature.
- class sphinx.addnodes.desc_sig_name(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[código-fonte]¶
Node for an identifier in a signature.
- class sphinx.addnodes.desc_sig_operator(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[código-fonte]¶
Node for an operator in a signature.
- class sphinx.addnodes.desc_sig_punctuation(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[código-fonte]¶
Node for punctuation in a signature.
- class sphinx.addnodes.desc_sig_keyword(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[código-fonte]¶
Node for a general keyword in a signature.
- class sphinx.addnodes.desc_sig_keyword_type(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[código-fonte]¶
Node for a keyword which is a built-in type in a signature.
- class sphinx.addnodes.desc_sig_literal_number(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[código-fonte]¶
Node for a numeric literal in a signature.
- class sphinx.addnodes.desc_sig_literal_string(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[código-fonte]¶
Node for a string literal in a signature.
- class sphinx.addnodes.desc_sig_literal_char(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[código-fonte]¶
Node for a character literal in a signature.
New admonition-like constructs¶
- class sphinx.addnodes.versionmodified(rawsource: str = '', text: str = '', *children, **attributes: Any)[código-fonte]¶
Node for version change entries.
Atualmente, são utilizadas as diretivas “version-added”, “version-changed”, “version-deprecated” e “version-removed”, juntamente com seus respectivos apelidos.
- class sphinx.addnodes.seealso(rawsource: str = '', *children, **attributes: Any)[código-fonte]¶
Custom “see also” admonition.
Other paragraph-level nodes¶
- class sphinx.addnodes.compact_paragraph(rawsource: str = '', text: str = '', *children, **attributes: Any)[código-fonte]¶
Node for a compact paragraph (which never makes a <p> node).
New inline nodes¶
- class sphinx.addnodes.index(rawsource: str = '', text: str = '', *children, **attributes: Any)[código-fonte]¶
Node for index entries.
This node is created by the
indexdirective and has one attribute,entries. Its value is a list of 5-tuples of(entrytype, entryname, target, ignored, key).entrytype is one of “single”, “pair”, “double”, “triple”.
key is categorization characters (usually a single character) for general index page. For the details of this, please see also:
glossaryand https://github.com/sphinx-doc/sphinx/pull/2320.
- class sphinx.addnodes.pending_xref(rawsource: str = '', *children, **attributes: Any)[código-fonte]¶
Node for cross-references that cannot be resolved without complete information about all documents.
These nodes are resolved before writing output, in BuildEnvironment.resolve_references.
- class sphinx.addnodes.pending_xref_condition(rawsource: str = '', text: str = '', *children, **attributes: Any)[código-fonte]¶
Node representing a potential way to create a cross-reference and the condition in which this way should be used.
This node is only allowed to be placed under a
pending_xrefnode. A pending_xref node must contain either no pending_xref_condition nodes or it must only contains pending_xref_condition nodes.The cross-reference resolver will replace a
pending_xrefwhich contains pending_xref_condition nodes by the content of exactly one of those pending_xref_condition nodes’ content. It uses the condition attribute to decide which pending_xref_condition node’s content to use. For example, let us consider how the cross-reference resolver acts on:<pending_xref refdomain="py" reftarget="io.StringIO ...> <pending_xref_condition condition="resolved"> <literal> StringIO <pending_xref_condition condition="*"> <literal> io.StringIO
If the cross-reference resolver successfully resolves the cross-reference, then it rewrites the pending_xref as:
<reference> <literal> StringIO
Otherwise, if the cross-reference resolution failed, it rewrites the pending_xref as:
<reference> <literal> io.StringIO
The pending_xref_condition node should have condition attribute. Domains can be store their individual conditions into the attribute to filter contents on resolving phase. As a reserved condition name,
condition="*"is used for the fallback of resolution failure. Additionally, as a recommended condition name,condition="resolved"represents a resolution success in the intersphinx module.Adicionado na versão 4.0.
- class sphinx.addnodes.literal_emphasis(rawsource: str = '', text: str = '', *children, **attributes: Any)[código-fonte]¶
Node that behaves like emphasis, but further text processors are not applied (e.g. smartypants for HTML output).
- class sphinx.addnodes.download_reference(rawsource: str = '', text: str = '', *children, **attributes: Any)[código-fonte]¶
Node for download references, similar to pending_xref.
Special nodes¶
- class sphinx.addnodes.only(rawsource: str = '', *children, **attributes: Any)[código-fonte]¶
Node for “only” directives (conditional inclusion based on tags).
- class sphinx.addnodes.highlightlang(rawsource: str = '', *children, **attributes: Any)[código-fonte]¶
Inserted to set the highlight language and line number options for subsequent code blocks.
You should not need to generate the nodes below in extensions.
- class sphinx.addnodes.glossary(rawsource: str = '', *children, **attributes: Any)[código-fonte]¶
Node to insert a glossary.
- class sphinx.addnodes.toctree(rawsource: str = '', *children, **attributes: Any)[código-fonte]¶
Node for inserting a “TOC tree”.
- class sphinx.addnodes.start_of_file(rawsource: str = '', *children, **attributes: Any)[código-fonte]¶
Node to mark start of a new file, used in the LaTeX builder only.
- class sphinx.addnodes.productionlist(rawsource: str = '', *children, **attributes: Any)[código-fonte]¶
Node for grammar production lists.
Contains
productionnodes.
- class sphinx.addnodes.production(rawsource: str = '', text: str = '', *children, **attributes: Any)[código-fonte]¶
Node for a single grammar production rule.