ビルド環境API¶
- class sphinx.environment.BuildEnvironment[ソース]¶
属性
- srcdir¶
ソースディレクトリ。
- doctreedir¶
pickle化された doctree を格納するディレクトリ
- events¶
EventManager
オブジェクト。
- found_docs¶
存在しているdocnameの集合
- metadata¶
docnameをメタデータにマッピングするための辞書です。(参考: ファイルに関するメタデータ).
- titles¶
docnameをdocutilのメインタイトルのノードにマッピングするための辞書です。
- docname¶
現在のドキュメントに対応するdocnameを返します。
- parser¶
Returns the parser being used for to parse the current document.
Per-document attributes
- current_document¶
Temporary data storage while reading a document.
Extensions may use the mapping interface provided by
env.current_document
to store data relating to the current document, but should use a unique prefix to avoid name clashes.重要
Only the following attributes constitute the public API. The type itself and any methods or other attributes remain private, experimental, and will be changed or removed without notice.
- current_document.default_role: str¶
The default role for the current document. Set by the default-role directive.
- current_document.default_domain: Domain | None¶
The default domain for the current document. Set by the
default-domain
directive.
- current_document.highlight_language: str¶
The default language for syntax highlighting. Set by the
highlight
directive to override thehighlight_language
config value.
ユーティリティ関数
- doc2path(docname: str, base: bool = True) _StrPath [ソース]¶
ドキュメント名に関連するファイル名を返します。
baseがTrueの場合には、self.srcdir以下の絶対パスを返します。 baseがFalseの場合には、self.srcdirからの相対パスを返します。
- relfn2path(filename: str, docname: str | None = None) tuple[str, str] [ソース]¶
ドキュメントに対応するファイルパスを、ドキュメントルートからの相対パスと絶対パスで返します。
"filename"が絶対パスであれば、ソースディレクトリからの相対パスとみなされます。*filename*が相対パスであれば、ドキュメントからの相対パスとみなされます。
- note_dependency(filename: str | PathLike[str], *, docname: str | None = None) None [ソース]¶
現在のドキュメントとの依存関係を示すための filename を追加します。
これにより、依存ファイルに変更が生じた際には現在のドキュメントもリビルドされます。
filenameは絶対パスもしくは、ソースディレクトリからの相対パスで指定する必要があります。