@@ -59,33 +59,39 @@ class Builder:
59
59
Builds target formats from the reST sources.
60
60
"""
61
61
62
- #: The builder's name, for the -b command line option.
63
- name = ''
62
+ #: The builder's name.
63
+ #: This is the value used to select builders on the command line.
64
+ name : str = ''
64
65
#: The builder's output format, or '' if no document output is produced.
65
- format = ''
66
- #: The message emitted upon successful build completion. This can be a
67
- #: printf-style template string with the following keys: ``outdir``,
68
- #: ``project``
69
- epilog = ''
66
+ #: This is commonly the file extension, e.g. "html",
67
+ #: though any string value is accepted.
68
+ #: The builder's format string can be used by various components
69
+ #: such as :class:`.SphinxPostTransform` or extensions to determine
70
+ #: their compatibility with the builder.
71
+ format : str = ''
72
+ #: The message emitted upon successful build completion.
73
+ #: This can be a printf-style template string
74
+ #: with the following keys: ``outdir``, ``project``
75
+ epilog : str = ''
70
76
71
77
#: default translator class for the builder. This can be overridden by
72
78
#: :py:meth:`~sphinx.application.Sphinx.set_translator`.
73
79
default_translator_class : type [nodes .NodeVisitor ]
74
80
# doctree versioning method
75
81
versioning_method = 'none'
76
82
versioning_compare = False
77
- #: allow parallel write_doc() calls
78
- allow_parallel = False
83
+ #: Whether it is safe to make parallel :meth:`~.Builder. write_doc()` calls.
84
+ allow_parallel : bool = False
79
85
# support translation
80
86
use_message_catalog = True
81
87
82
88
#: The list of MIME types of image formats supported by the builder.
83
89
#: Image files are searched in the order in which they appear here.
84
90
supported_image_types : list [str ] = []
85
91
#: The builder can produce output documents that may fetch external images when opened.
86
- supported_remote_images = False
92
+ supported_remote_images : bool = False
87
93
#: The file format produced by the builder allows images to be embedded using data-URIs.
88
- supported_data_uri_images = False
94
+ supported_data_uri_images : bool = False
89
95
90
96
def __init__ (self , app : Sphinx , env : BuildEnvironment ) -> None :
91
97
self .srcdir = app .srcdir
@@ -159,7 +165,7 @@ def get_target_uri(self, docname: str, typ: str | None = None) -> str:
159
165
def get_relative_uri (self , from_ : str , to : str , typ : str | None = None ) -> str :
160
166
"""Return a relative URI between two source filenames.
161
167
162
- May raise environment. NoUri if there's no way to return a sensible URI.
168
+ :raises: :exc:`! NoUri` if there's no way to return a sensible URI.
163
169
"""
164
170
return relative_uri (
165
171
self .get_target_uri (from_ ),
@@ -789,7 +795,16 @@ def copy_assets(self) -> None:
789
795
pass
790
796
791
797
def write_doc (self , docname : str , doctree : nodes .document ) -> None :
792
- """Where you actually write something to the filesystem."""
798
+ """
799
+ Write the output file for the document
800
+
801
+ :param docname: the :term:`docname <document name>`.
802
+ :param doctree: defines the content to be written.
803
+
804
+ The output filename must be determined within this method,
805
+ typically by calling :meth:`~.Builder.get_target_uri`
806
+ or :meth:`~.Builder.get_relative_uri`.
807
+ """
793
808
raise NotImplementedError
794
809
795
810
def write_doc_serialized (self , docname : str , doctree : nodes .document ) -> None :
0 commit comments