Sphinx添加的Doctree节点类

域特定对象描述的节点

顶级节点

这些节点构成了对象描述的最顶层

class sphinx.addnodes.desc(rawsource='', *children, **attributes)[源代码]

对象签名列表及其通用描述的节点。

包含一项或多项 desc_signature 节点,然后是一个单个:py:class:desc_content 节点。

This node always has two classes:

  • The name of the domain it belongs to, e.g., py or cpp.

  • The name of the object type in the domain, e.g., function.

class sphinx.addnodes.desc_signature(*args: Any, **kwargs: Any)[源代码]

Node for a single object signature.

As default the signature is a single-line signature. Set is_multiline = True to describe a multi-line signature. In that case all child nodes must be desc_signature_line nodes.

This node always has the classes sig, sig-object, and the domain it belongs to.

class sphinx.addnodes.desc_signature_line(rawsource='', text='', *children, **attributes)[源代码]

Node for a line in a multi-line object signature.

It should only be used as a child of a desc_signature with is_multiline set to True. Set add_permalink = True for the line that should get the permalink.

class sphinx.addnodes.desc_content(rawsource='', *children, **attributes)[源代码]

对象描述内容的节点。

Must be the last child node in a desc node.

class sphinx.addnodes.desc_inline(domain: str, *args: Any, **kwargs: Any)[源代码]

Node for a signature fragment in inline text.

This is for example used for roles like cpp:expr.

This node always has the classes sig, sig-inline, and the name of the domain it belongs to.

Nodes for high-level structure in signatures

These nodes occur in in non-multiline desc_signature nodes and in desc_signature_line nodes.

class sphinx.addnodes.desc_name(*args: Any, **kwargs: Any)[源代码]

主对象名称的节点。

For example, in the declaration of a Python class MyModule.MyClass, the main name is MyClass.

This node always has the class sig-name.

class sphinx.addnodes.desc_addname(*args: Any, **kwargs: Any)[源代码]

Node for additional name parts for an object.

For example, in the declaration of a Python class MyModule.MyClass, the additional name part is MyModule..

This node always has the class sig-prename.

class sphinx.addnodes.desc_type(rawsource='', text='', *children, **attributes)[源代码]

返回类型或对象类型名称的节点。

class sphinx.addnodes.desc_returns(rawsource='', text='', *children, **attributes)[源代码]

“returns”注释的节点(Python中的la->)。

class sphinx.addnodes.desc_parameterlist(rawsource='', text='', *children, **attributes)[源代码]

常规参数列表的节点。

As default the parameter list is written in line with the rest of the signature. Set multi_line_parameter_list = True to describe a multi-line parameter list. In that case each parameter will then be written on its own, indented line.

class sphinx.addnodes.desc_parameter(rawsource='', text='', *children, **attributes)[源代码]

单个参数的节点。

class sphinx.addnodes.desc_optional(rawsource='', text='', *children, **attributes)[源代码]

用于标记参数列表的可选部分的节点。

class sphinx.addnodes.desc_annotation(rawsource='', text='', *children, **attributes)[源代码]

用于签名批注(而不是Python 3样式批注)的节点。

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_element and using the class keyword argument _sig_element=True.

class sphinx.addnodes.desc_sig_element(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[源代码]

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)[源代码]

Node for a space in a signature.

class sphinx.addnodes.desc_sig_name(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[源代码]

Node for an identifier in a signature.

class sphinx.addnodes.desc_sig_operator(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[源代码]

Node for an operator in a signature.

class sphinx.addnodes.desc_sig_punctuation(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[源代码]

Node for punctuation in a signature.

class sphinx.addnodes.desc_sig_keyword(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[源代码]

Node for a general keyword in a signature.

class sphinx.addnodes.desc_sig_keyword_type(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[源代码]

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)[源代码]

Node for a numeric literal in a signature.

class sphinx.addnodes.desc_sig_literal_string(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[源代码]

Node for a string literal in a signature.

class sphinx.addnodes.desc_sig_literal_char(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[源代码]

Node for a character literal in a signature.

新的指令

class sphinx.addnodes.versionmodified(rawsource='', text='', *children, **attributes)[源代码]

版本更改条目的节点。

Currently used for “versionadded”, “versionchanged”, “deprecated” and “versionremoved” directives.

class sphinx.addnodes.seealso(rawsource='', *children, **attributes)[源代码]

对应的“请参阅”警告。

其他段落级节点

class sphinx.addnodes.compact_paragraph(rawsource='', text='', *children, **attributes)[源代码]

紧凑段落的节点(从不生成节点)。

新建内联节点

class sphinx.addnodes.index(rawsource='', text='', *children, **attributes)[源代码]

索引项的节点。

此节点由“index”指令创建,有一个属性“entries”。它的值是5个元组的列表``(entrytype,entryname,target,ignored,key)```。

*entrytype*是“single”、“pair”、“double”、“triple”之一。

*关键字*是通用索引页的分类字符(通常是单个字符)。有关详细信息,请参见:rst:方向:`glossary`和第2320期。

class sphinx.addnodes.pending_xref(rawsource='', *children, **attributes)[源代码]

节点,用于在没有有关所有文档的完整信息的情况下无法解析的交叉引用。

在中写入输出之前,将解析这些节点BuildEnvironment.resolve_引用.

class sphinx.addnodes.pending_xref_condition(rawsource='', text='', *children, **attributes)[源代码]

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_xref node. 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_xref which 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.

Added in version 4.0.

class sphinx.addnodes.literal_emphasis(rawsource='', text='', *children, **attributes)[源代码]

行为类似“emphasis”,但不应用其他文本处理器的节点(例如,用于HTML输出的smartypants)。

class sphinx.addnodes.download_reference(rawsource='', text='', *children, **attributes)[源代码]

节点,用于下载引用,类似于挂起的外部参照。

特殊节点

class sphinx.addnodes.only(rawsource='', *children, **attributes)[源代码]

“only”指令的节点(基于标记的条件包含)。

class sphinx.addnodes.highlightlang(rawsource='', *children, **attributes)[源代码]

插入以设置后续代码块的突出显示语言和行号选项。

您不需要在扩展中生成以下节点。

class sphinx.addnodes.glossary(rawsource='', *children, **attributes)[源代码]

节点以插入词汇表。

class sphinx.addnodes.toctree(rawsource='', *children, **attributes)[源代码]

用于插入“目录树”的节点。

class sphinx.addnodes.start_of_file(rawsource='', *children, **attributes)[源代码]

标记新文件开始的节点,仅在LaTeX builder中使用。

class sphinx.addnodes.productionlist(rawsource='', *children, **attributes)[源代码]

语法生成列表的节点。

包含“生产”节点。

class sphinx.addnodes.production(rawsource='', text='', *children, **attributes)[源代码]

单个语法生成规则的节点。