sphinx添加的doctree节点类

域特定对象描述的节点

顶级节点

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

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

节点,以获取对象签名及其常见描述的列表。

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

此节点始终有两个类:

  • 它所属的域名,例如, pycpp

  • 域中对象类型的名称,例如, function

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

节点用于单个对象签名。

默认情况下,签名为单行签名。集 is_multiline = True 来描述多行签名。在这种情况下,所有子节点必须 desc_signature_line 节点。

此节点始终具有类 sigsig-object ,以及它所属的域。

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

多行对象签名中行的节点。

它只应用作 desc_signature 使用 is_multiline 设置为 True 。集 add_permalink = True 对于应该获得永久链接的行。

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

对象描述内容的节点。

中的最后一个子节点。 desc 节点。

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

内联文本中签名片段的节点。

例如,它用于如下角色 cpp:expr

此节点始终具有类 sigsig-inline 以及它所属的域的名称。

签名中高层结构的节点

这些节点以非多行形式出现在中 desc_signature 节点和中 desc_signature_line 节点。

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

主对象名称的节点。

例如,在一个Python类的声明中 MyModule.MyClass ,主名是 MyClass

此节点始终具有类 sig-name

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

用于对象的其他名称部分的节点。

例如,在一个Python类的声明中 MyModule.MyClass ,附加名称部分为 MyModule.

此节点始终具有类 sig-prename

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

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

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

“返回”注释的节点(Python中的la->

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

常规参数列表的节点。

默认情况下,参数列表与签名的其余部分一起写入。集 multi_line_parameter_list = True 以描述多行参数列表。在这种情况下,每个参数将被写在其自己的缩进行上。

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样式批注)。

签名文本元素的节点

这些节点继承 desc_sig_element 并且通常被翻译成 docutils.nodes.inline 通过 SigElementFallbackTransform

扩展可能会创建额外的 desc_sig_* -类似节点,但顺序为 SigElementFallbackTransform 要自动将它们转换为内联节点,必须将它们添加到 SIG_ELEMENTS 通过CLASS关键字参数 _sig_element=Truedesc_sig_element ,例如:

class desc_custom_sig_node(desc_sig_element, _sig_element=True): ...

为了向后兼容,仍然可以使用直接添加节点 SIG_ELEMENTS.add(desc_custom_sig_node)

sphinx.addnodes.SIG_ELEMENTS: set[type[desc_sig_element]]

继承的一组类 desc_sig_element 。如果构建器的Translator类不是从SphinxTranslator继承的,则每个节点类都应该由构建器的Translator类处理。

可以通过第三方扩展或子类化来手动扩展此集合 desc_sig_element 并使用CLASS关键字参数 _sig_element=True

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

签名的内联文本的公共节点父类。

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

节点表示签名中的空格。

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

签名中的标识符的节点。

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

签名中运算符的节点。

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

用于签名中标点符号的节点。

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

签名中常规关键字的节点。

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

关键字的节点,它是签名中的内置类型。

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

签名中数字文字的节点。

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

签名中字符串文字的节点。

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

签名中字符文字的节点。

新的警告类结构

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

版本更改条目的节点。

当前用于“版本添加”、“版本更改”、“已弃用”和“版本删除”指令。

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

自定义“另见”警告。

其他段落级节点

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

紧凑段落的节点(它从不构成<p>节点)。

新建内联节点

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

索引项的节点。

此节点由 index 指令并有一个属性, entries . 它的值是5个元组的列表 (entrytype, entryname, target, ignored, key) .

输入型 是“单”、“双”、“双”、“三”之一。

key 是常规索引页的分类字符(通常为单个字符)。有关详细信息,请参见: glossary 发行2320。

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

如果没有有关所有文档的完整信息,则无法解析交叉引用的节点。

这些节点在写入输出之前在buildEnvironment.resolve_引用中解析。

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

节点,表示创建交叉引用的可能方式以及应使用此方式的条件。

此节点仅允许放置在 pending_xref 节点。一个 pending_xref 节点必须包含无 pending_xref_condition 节点,否则它必须仅包含 pending_xref_condition 节点。

交叉引用冲突解决程序将替换 pending_xref 其中包含 pending_xref_condition 节点中的任何一个的内容 pending_xref_condition 节点的内容。它使用 condition 属性来确定哪个 pending_xref_condition 要使用的节点的内容。例如,让我们考虑交叉引用解析器如何作用于:

<pending_xref refdomain="py" reftarget="io.StringIO ...>
    <pending_xref_condition condition="resolved">
        <literal>
            StringIO
    <pending_xref_condition condition="*">
        <literal>
            io.StringIO

如果交叉引用解析器成功解析交叉引用,则它会重写 pending_xref AS::

<reference>
    <literal>
        StringIO

否则,如果交叉引用解析失败,它将重写 pending_xref AS::

<reference>
    <literal>
        io.StringIO

这个 pending_xref_condition 节点应具有 condition 属性。域可以将其各自的条件存储到属性中,以便在解析阶段过滤内容。作为保留的条件名称, condition="*" 用于解析失败的回退。此外,作为推荐的条件名称, condition="resolved" 表示Intersphinx模块中的解析成功。

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

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

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

用于语法生成列表的节点。

包含 production 节点。

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

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