ビルド環境API

class sphinx.environment.BuildEnvironment[ソース]

属性

app

Sphinx (application) オブジェクトへの参照です

config

Config オブジェクトへの参照です。

project

ターゲットプロジェクト。 Project を参照してください。

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.docname: str

The document name ('docname') for the current document.

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 the highlight_language config value.

current_document._parser: Parser | None

This attribute is experimental and may be changed without notice.

The parser being used to parse the current document.

ユーティリティ関数

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は絶対パスもしくは、ソースディレクトリからの相対パスで指定する必要があります。

new_serialno(category: str = '') int[ソース]

インデックスなどで用いるための、シリアルナンバーを返します。

このシリアル番号は、現在の文書のなかで一意であることが保証されます。

note_reread() None[ソース]

現在のドキュメントを、次回ビルドの際に自動再読み込みするドキュメント一覧に追加します。