Sphinxが追加するDoctreeノードクラス¶
ドメイン固有のオブジェクト記述のためのノード¶
トップレベルノード¶
これらのノードは、オブジェクト記述の最上位レベルを形成します。
- class sphinx.addnodes.desc(rawsource='', *children, **attributes)[source]¶
オブジェクトのシグネチャのリストとそれらの共通の説明のためのノード。
1つ以上の
desc_signature
ノードと、それに続く単一のdesc_content
ノードを含みます。このノードには常に2つのクラスがあります。
属するドメインの名前(例:
py
またはcpp
)。ドメイン内のオブジェクトの種類の名前(例:
function
)。
- class sphinx.addnodes.desc_signature(*args: Any, **kwargs: Any)[source]¶
単一のオブジェクトシグネチャのためのノード。
デフォルトでは、シグネチャは単一行のシグネチャです。
is_multiline = True
を設定して、複数行のシグネチャを記述します。その場合、すべての子ノードはdesc_signature_line
ノードでなければなりません。このノードには常に
sig
、sig-object
、および属するドメインのクラスがあります。
- class sphinx.addnodes.desc_signature_line(rawsource='', text='', *children, **attributes)[source]¶
複数行のオブジェクトシグネチャ内の行のためのノード。
is_multiline
がTrue
に設定されたdesc_signature
の子ノードとしてのみ使用してください。add_permalink = True
を設定すると、パーマリンクを取得する行になります。
シグネチャ内のハイレベル構造のためのノード¶
これらのノードは、複数行ではないdesc_signature
ノードとdesc_signature_line
ノードに現れます。
- class sphinx.addnodes.desc_name(*args: Any, **kwargs: Any)[source]¶
主要なオブジェクト名のためのノード。
例えば、Pythonクラス
MyModule.MyClass
の宣言では、主要な名前はMyClass
です。このノードには常に
sig-name
クラスがあります。
- class sphinx.addnodes.desc_addname(*args: Any, **kwargs: Any)[source]¶
オブジェクトに追加の名前部分のためのノード。
例えば、Pythonクラス
MyModule.MyClass
の宣言では、追加の名前部分はMyModule.
です。このノードには常に
sig-prename
クラスがあります。
- class sphinx.addnodes.desc_type(rawsource='', text='', *children, **attributes)[source]¶
戻り値の型またはオブジェクトの型名を表すノード。
- class sphinx.addnodes.desc_returns(rawsource='', text='', *children, **attributes)[source]¶
「returns」アノテーション(Pythonの->のようなもの)を表すノード。
- class sphinx.addnodes.desc_parameterlist(rawsource='', text='', *children, **attributes)[source]¶
一般的なパラメータリストを表すノード。
デフォルトでは、パラメータリストはシグネチャの残りの部分と一行で記述されます。
multi_line_parameter_list = True
を設定すると、複数行のパラメータリストを記述できます。その場合、各パラメータはそれぞれインデントされた独自の行に記述されます。
- class sphinx.addnodes.desc_parameter(rawsource='', text='', *children, **attributes)[source]¶
単一のパラメータを表すノード。
シグネチャテキスト要素のノード¶
これらのノードはdesc_sig_element
を継承し、一般的にSigElementFallbackTransform
によってdocutils.nodes.inline
に変換されます。
拡張機能は追加のdesc_sig_*
のようなノードを作成できますが、SigElementFallbackTransform
がそれらをインラインノードに自動的に変換するためには、desc_sig_element
のクラスキーワード引数_sig_element=True
を使用してSIG_ELEMENTS
に追加する必要があります。例えば、
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
を継承するクラスの集合です。後者がSphinxTranslatorを継承していない場合、各ノードクラスはビルダーのトランスレータクラスによって処理されることが期待されます。この集合は、サードパーティの拡張機能によって、または
desc_sig_element
をサブクラス化し、クラスキーワード引数_sig_element=Trueを使用することで、手動で拡張できます。
- class sphinx.addnodes.desc_sig_element(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[source]¶
シグネチャのインラインテキストのノードの共通の親クラス。
- class sphinx.addnodes.desc_sig_space(rawsource: str = '', text: str = ' ', *children: Element, **attributes: Any)[source]¶
シグネチャ内のスペースを表すノード。
- class sphinx.addnodes.desc_sig_name(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[source]¶
シグネチャ内の識別子を表すノード。
- class sphinx.addnodes.desc_sig_operator(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[source]¶
シグネチャ内の演算子を表すノード。
- class sphinx.addnodes.desc_sig_punctuation(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[source]¶
シグネチャ内の句読点を表すノード。
- class sphinx.addnodes.desc_sig_keyword(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[source]¶
シグネチャ内の一般的なキーワードを表すノード。
- class sphinx.addnodes.desc_sig_keyword_type(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[source]¶
シグネチャ内で組み込み型であるキーワードを表すノード。
- class sphinx.addnodes.desc_sig_literal_number(rawsource: str = '', text: str = '', *children: Element, **attributes: Any)[source]¶
シグネチャ内の数値リテラルを表すノード。
新しい注意書きのような構造¶
その他の段落レベルノード¶
新しいインラインノード¶
- class sphinx.addnodes.index(rawsource='', text='', *children, **attributes)[source]¶
索引項目のためのノード。
`index`ディレクティブによって作成され、`entries`という属性を持ちます。その値は、`(entrytype, entryname, target, ignored, key)`の5要素タプルからなるリストです。
`entrytype`は、「single」、「pair」、「double」、「triple」のいずれかです。
`key`は、一般的な索引ページのための分類文字(通常は1文字)です。詳細については、
glossary
およびissue #2320も参照してください。
- class sphinx.addnodes.pending_xref(rawsource='', *children, **attributes)[source]¶
すべてのドキュメントに関する完全な情報なしでは解決できない相互参照のためのノード。
これらのノードは、出力の書き込み前に、BuildEnvironment.resolve_referencesで解決されます。
- class sphinx.addnodes.pending_xref_condition(rawsource='', text='', *children, **attributes)[source]¶
相互参照を作成する可能性のある方法と、その方法を使用する条件を表すノード。
このノードは、
pending_xref
ノードの下に配置することのみが許されます。**pending_xref**ノードは、**pending_xref_condition**ノードを含まないか、または**pending_xref_condition**ノードのみを含む必要があります。相互参照解決器は、**pending_xref_condition**ノードを含む
pending_xref
を、これらの**pending_xref_condition**ノードのコンテンツのちょうど1つのコンテンツで置き換えます。**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**は次のように書き換えられます。
<reference> <literal> StringIO
それ以外の場合、相互参照の解決に失敗した場合、**pending_xref**は次のように書き換えられます。
<reference> <literal> io.StringIO
**pending_xref_condition**ノードは、**condition**属性を持つ必要があります。ドメインは、解決フェーズでコンテンツをフィルタリングするために、個々の条件を属性に格納できます。予約済み条件名として、`condition="*"`は解決失敗のフォールバックに使用されます。さらに、推奨される条件名として、`condition="resolved"`はintersphinxモジュールでの解決成功を表します。
バージョン4.0で追加。
特殊ノード¶
- class sphinx.addnodes.only(rawsource='', *children, **attributes)[source]¶
「only」ディレクティブ(タグに基づいた条件付きインクルージョン)のためのノード。
- class sphinx.addnodes.highlightlang(rawsource='', *children, **attributes)[source]¶
後続のコードブロックの強調表示言語と行番号のオプションを設定するために挿入されます。
拡張機能で以下のノードを生成する必要はありません。
- class sphinx.addnodes.start_of_file(rawsource='', *children, **attributes)[source]¶
LaTeXビルダーでのみ使用される、新しいファイルの開始を示すノードです。