class Domain:
Known subclasses: sphinx.domains.python.PythonDomain
, sphinx.domains.c.CDomain
, sphinx.domains.changeset.ChangeSetDomain
, sphinx.domains.citation.CitationDomain
, sphinx.domains.cpp.CPPDomain
, sphinx.domains.index.IndexDomain
, sphinx.domains.javascript.JavaScriptDomain
, sphinx.domains.math.MathDomain
, sphinx.domains.rst.ReSTDomain
, sphinx.domains.std.StandardDomain
, sphinx.ext.duration.DurationDomain
, sphinx.ext.todo.TodoDomain
A Domain is meant to be a group of "object" description directives for objects of a similar nature, and corresponding roles to create references to them. Examples would be Python modules, classes, functions etc., elements of a templating language, Sphinx roles and directives, etc.
Each domain has a separate storage for information about existing objects
and how to reference them in self.data
, which must be a dictionary. It
also must implement several functions that expose the object information in
a uniform way to parts of Sphinx that allow the user to reference or search
for objects in a domain-agnostic way.
About self.data
: since all object and cross-referencing information is
stored on a BuildEnvironment instance, the domain.data
object is also
stored in the env.domaindata
dict under the key domain.name
. Before the
build process starts, every active domain is instantiated and given the
environment object; the domaindata
dict must then either be nonexistent or
a dictionary whose 'version' key is equal to the domain class'
data_version
attribute. Otherwise, OSError
is raised and the
pickled environment is discarded.
Method | add_object_type |
Add an object type. |
Method | check_consistency |
Do consistency checks (experimental). |
Method | clear_doc |
Remove traces of a document in the domain-specific inventories. |
Method | directive |
Return a directive adapter class that always gives the registered directive its full name ('domain:name') as self.name. |
Method | get_enumerable_node_type |
Get type of enumerable nodes (experimental). |
Method | get_full_qualified_name |
Return full qualified name for given node. |
Method | get_objects |
Return an iterable of "object descriptions". |
Method | get_type_name |
Return full name for given ObjType. |
Method | merge_domaindata |
Merge in data regarding docnames from a different domaindata inventory (coming from a subprocess in parallel builds). |
Method | process_doc |
Process a document after it is read by the environment. |
Method | process_field_xref |
Process a pending xref created in a doc field. For example, attach information about the current scope. |
Method | resolve_any_xref |
Resolve the pending_xref node with the given target. |
Method | resolve_xref |
Resolve the pending_xref node with the given typ and target. |
Method | role |
Return a role adapter function that always gives the registered role its full name ('domain:name') as the first argument. |
Method | setup |
Set up domain object. |
Class Variable | dangling_warnings |
Undocumented |
Class Variable | data_version |
Undocumented |
Class Variable | enumerable_nodes |
Undocumented |
Class Variable | initial_data |
Undocumented |
Class Variable | label |
Undocumented |
Class Variable | name |
Undocumented |
Instance Variable | data |
Undocumented |
Instance Variable | directives |
Undocumented |
Instance Variable | indices |
Undocumented |
Instance Variable | object_types |
Undocumented |
Instance Variable | roles |
Undocumented |
Method | __init__ |
Undocumented |
Instance Variable | _directive_cache |
Undocumented |
Instance Variable | _role2type |
Undocumented |
Instance Variable | _role_cache |
Undocumented |
Instance Variable | _type2role |
Undocumented |
Instance Variable | env |
Undocumented |
Instance Variable | objtypes_for_role |
Undocumented |
Instance Variable | role_for_objtype |
Undocumented |
Parameters | |
name:str | Undocumented |
objtype:ObjType | Undocumented |
sphinx.domains.citation.CitationDomain
sphinx.domains.python.PythonDomain
, sphinx.domains.c.CDomain
, sphinx.domains.changeset.ChangeSetDomain
, sphinx.domains.citation.CitationDomain
, sphinx.domains.cpp.CPPDomain
, sphinx.domains.index.IndexDomain
, sphinx.domains.javascript.JavaScriptDomain
, sphinx.domains.math.MathDomain
, sphinx.domains.rst.ReSTDomain
, sphinx.domains.std.StandardDomain
, sphinx.ext.duration.DurationDomain
, sphinx.ext.todo.TodoDomain
Parameters | |
docname:str | Undocumented |
Parameters | |
name:str | Undocumented |
Returns | |
Optional[ | Undocumented |
sphinx.domains.std.StandardDomain
Parameters | |
node:Node | Undocumented |
Returns | |
Optional[ | Undocumented |
sphinx.domains.python.PythonDomain
, sphinx.domains.cpp.CPPDomain
, sphinx.domains.javascript.JavaScriptDomain
, sphinx.domains.std.StandardDomain
Parameters | |
node:Element | Undocumented |
Returns | |
Optional[ | Undocumented |
sphinx.domains.python.PythonDomain
, sphinx.domains.c.CDomain
, sphinx.domains.cpp.CPPDomain
, sphinx.domains.javascript.JavaScriptDomain
, sphinx.domains.math.MathDomain
, sphinx.domains.rst.ReSTDomain
, sphinx.domains.std.StandardDomain
Return an iterable of "object descriptions".
Object descriptions are tuples with six items:
How "important" the object is (determines placement in search results). One of:
Returns | |
Iterable[ | Undocumented |
sphinx.domains.std.StandardDomain
Parameters | |
type:ObjType | Undocumented |
primary:bool | Undocumented |
Returns | |
str | Undocumented |
sphinx.domains.python.PythonDomain
, sphinx.domains.c.CDomain
, sphinx.domains.changeset.ChangeSetDomain
, sphinx.domains.citation.CitationDomain
, sphinx.domains.cpp.CPPDomain
, sphinx.domains.index.IndexDomain
, sphinx.domains.javascript.JavaScriptDomain
, sphinx.domains.math.MathDomain
, sphinx.domains.rst.ReSTDomain
, sphinx.domains.std.StandardDomain
, sphinx.ext.duration.DurationDomain
, sphinx.ext.todo.TodoDomain
Parameters | |
docnames:List[ | Undocumented |
otherdata:Dict | Undocumented |
sphinx.domains.c.CDomain
, sphinx.domains.changeset.ChangeSetDomain
, sphinx.domains.cpp.CPPDomain
, sphinx.domains.index.IndexDomain
, sphinx.domains.math.MathDomain
, sphinx.domains.std.StandardDomain
, sphinx.ext.todo.TodoDomain
Parameters | |
env:BuildEnvironment | Undocumented |
docname:str | Undocumented |
document:nodes.document | Undocumented |
sphinx.domains.c.CDomain
, sphinx.domains.cpp.CPPDomain
Parameters | |
pnode:pending_xref | Undocumented |
sphinx.domains.python.PythonDomain
, sphinx.domains.c.CDomain
, sphinx.domains.citation.CitationDomain
, sphinx.domains.cpp.CPPDomain
, sphinx.domains.javascript.JavaScriptDomain
, sphinx.domains.math.MathDomain
, sphinx.domains.rst.ReSTDomain
, sphinx.domains.std.StandardDomain
Resolve the pending_xref node with the given target.
The reference comes from an "any" or similar role, which means that we
don't know the type. Otherwise, the arguments are the same as for
resolve_xref
.
The method must return a list (potentially empty) of tuples
('domain:role', newnode), where 'domain:role' is the name of a
role that could have created the same reference, e.g. 'py:func'.
newnode is what resolve_xref
would return.
Parameters | |
env:BuildEnvironment | Undocumented |
fromdocname:str | Undocumented |
builder:Builder | Undocumented |
target:str | Undocumented |
node:pending_xref | Undocumented |
contnode:Element | Undocumented |
Returns | |
List[ | Undocumented |
sphinx.domains.python.PythonDomain
, sphinx.domains.c.CDomain
, sphinx.domains.citation.CitationDomain
, sphinx.domains.cpp.CPPDomain
, sphinx.domains.javascript.JavaScriptDomain
, sphinx.domains.math.MathDomain
, sphinx.domains.rst.ReSTDomain
, sphinx.domains.std.StandardDomain
Resolve the pending_xref node with the given typ and target.
This method should return a new node, to replace the xref node, containing the contnode which is the markup content of the cross-reference.
If no resolution can be found, None can be returned; the xref node will then given to the :event:`missing-reference` event, and if that yields no resolution, replaced by contnode.
The method can also raise sphinx.environment.NoUri
to suppress
the :event:`missing-reference` event being emitted.
Parameters | |
env:BuildEnvironment | Undocumented |
fromdocname:str | Undocumented |
builder:Builder | Undocumented |
typ:str | Undocumented |
target:str | Undocumented |
node:pending_xref | Undocumented |
contnode:Element | Undocumented |
Returns | |
Optional[ | Undocumented |
Parameters | |
name:str | Undocumented |
Returns | |
Optional[ | Undocumented |
Dict[ str, str]
=
sphinx.domains.citation.CitationDomain
, sphinx.domains.math.MathDomain
, sphinx.domains.std.StandardDomain
Undocumented
Dict[ Type[ Node], Tuple[ str, Callable]]
=
sphinx.domains.math.MathDomain
, sphinx.domains.std.StandardDomain
Undocumented
Dict
=
sphinx.domains.python.PythonDomain
, sphinx.domains.c.CDomain
, sphinx.domains.changeset.ChangeSetDomain
, sphinx.domains.cpp.CPPDomain
, sphinx.domains.javascript.JavaScriptDomain
, sphinx.domains.math.MathDomain
, sphinx.domains.rst.ReSTDomain
, sphinx.domains.std.StandardDomain
Undocumented
str
=
sphinx.domains.python.PythonDomain
, sphinx.domains.c.CDomain
, sphinx.domains.changeset.ChangeSetDomain
, sphinx.domains.citation.CitationDomain
, sphinx.domains.cpp.CPPDomain
, sphinx.domains.index.IndexDomain
, sphinx.domains.javascript.JavaScriptDomain
, sphinx.domains.math.MathDomain
, sphinx.domains.rst.ReSTDomain
, sphinx.domains.std.StandardDomain
, sphinx.ext.todo.TodoDomain
Undocumented
str
=
sphinx.domains.python.PythonDomain
, sphinx.domains.c.CDomain
, sphinx.domains.changeset.ChangeSetDomain
, sphinx.domains.citation.CitationDomain
, sphinx.domains.cpp.CPPDomain
, sphinx.domains.index.IndexDomain
, sphinx.domains.javascript.JavaScriptDomain
, sphinx.domains.math.MathDomain
, sphinx.domains.rst.ReSTDomain
, sphinx.domains.std.StandardDomain
, sphinx.ext.duration.DurationDomain
, sphinx.ext.todo.TodoDomain
Undocumented
sphinx.domains.std.StandardDomain
Undocumented
Parameters | |
env:BuildEnvironment | Undocumented |