2014-01-20 10:21:44 -06:00
|
|
|
Build environment API
|
|
|
|
=====================
|
|
|
|
|
|
|
|
.. module:: sphinx.environment
|
|
|
|
|
|
|
|
.. class:: BuildEnvironment
|
|
|
|
|
|
|
|
**Attributes**
|
|
|
|
|
|
|
|
.. attribute:: app
|
|
|
|
|
2014-01-24 13:22:58 -06:00
|
|
|
Reference to the :class:`.Sphinx` (application) object.
|
2014-01-20 10:21:44 -06:00
|
|
|
|
|
|
|
.. attribute:: config
|
|
|
|
|
|
|
|
Reference to the :class:`.Config` object.
|
|
|
|
|
2018-01-18 03:23:57 -06:00
|
|
|
.. attribute:: project
|
|
|
|
|
|
|
|
Target project. See :class:`.Project`.
|
|
|
|
|
2014-01-20 10:21:44 -06:00
|
|
|
.. attribute:: srcdir
|
|
|
|
|
2016-01-06 23:18:40 -06:00
|
|
|
Source directory.
|
|
|
|
|
2014-01-20 10:21:44 -06:00
|
|
|
.. attribute:: doctreedir
|
|
|
|
|
|
|
|
Directory for storing pickled doctrees.
|
|
|
|
|
2019-03-09 01:46:41 -06:00
|
|
|
.. attribute:: events
|
|
|
|
|
|
|
|
An :class:`.EventManager` object.
|
|
|
|
|
2014-01-20 10:21:44 -06:00
|
|
|
.. attribute:: found_docs
|
|
|
|
|
|
|
|
A set of all existing docnames.
|
|
|
|
|
|
|
|
.. attribute:: metadata
|
|
|
|
|
|
|
|
Dictionary mapping docnames to "metadata" (see :ref:`metadata`).
|
|
|
|
|
|
|
|
.. attribute:: titles
|
|
|
|
|
|
|
|
Dictionary mapping docnames to the docutils node for their main title.
|
|
|
|
|
|
|
|
.. autoattribute:: docname
|
|
|
|
|
2024-06-21 08:48:59 -05:00
|
|
|
.. autoattribute:: parser
|
|
|
|
|
2025-01-03 18:28:03 -06:00
|
|
|
**Per-document attributes**
|
|
|
|
|
|
|
|
.. attribute:: 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.
|
|
|
|
|
|
|
|
.. important::
|
|
|
|
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.
|
|
|
|
|
|
|
|
.. attribute:: current_document.docname
|
|
|
|
:type: str
|
|
|
|
|
|
|
|
The document name ('docname') for the current document.
|
|
|
|
|
|
|
|
.. attribute:: current_document.default_role
|
|
|
|
:type: str
|
|
|
|
|
|
|
|
The default role for the current document.
|
|
|
|
Set by the :dudir:`default-role` directive.
|
|
|
|
|
|
|
|
.. attribute:: current_document.default_domain
|
|
|
|
:type: Domain | None
|
|
|
|
|
|
|
|
The default domain for the current document.
|
|
|
|
Set by the :rst:dir:`default-domain` directive.
|
|
|
|
|
|
|
|
.. attribute:: current_document.highlight_language
|
|
|
|
:type: str
|
|
|
|
|
|
|
|
The default language for syntax highlighting.
|
|
|
|
Set by the :rst:dir:`highlight` directive to override
|
|
|
|
the :confval:`highlight_language` config value.
|
|
|
|
|
|
|
|
.. attribute:: current_document._parser
|
|
|
|
:type: Parser | None
|
|
|
|
|
|
|
|
*This attribute is experimental and may be changed without notice.*
|
|
|
|
|
|
|
|
The parser being used to parse the current document.
|
|
|
|
|
2014-01-20 10:21:44 -06:00
|
|
|
**Utility methods**
|
|
|
|
|
|
|
|
.. automethod:: doc2path
|
|
|
|
|
|
|
|
.. automethod:: relfn2path
|
|
|
|
|
|
|
|
.. automethod:: note_dependency
|
|
|
|
|
|
|
|
.. automethod:: new_serialno
|
|
|
|
|
|
|
|
.. automethod:: note_reread
|