@@ -59,33 +59,39 @@ class Builder:
5959 Builds target formats from the reST sources.
6060 """
6161
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 = ''
6465 #: 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 = ''
7076
7177 #: default translator class for the builder. This can be overridden by
7278 #: :py:meth:`~sphinx.application.Sphinx.set_translator`.
7379 default_translator_class : type [nodes .NodeVisitor ]
7480 # doctree versioning method
7581 versioning_method = 'none'
7682 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
7985 # support translation
8086 use_message_catalog = True
8187
8288 #: The list of MIME types of image formats supported by the builder.
8389 #: Image files are searched in the order in which they appear here.
8490 supported_image_types : list [str ] = []
8591 #: The builder can produce output documents that may fetch external images when opened.
86- supported_remote_images = False
92+ supported_remote_images : bool = False
8793 #: 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
8995
9096 def __init__ (self , app : Sphinx , env : BuildEnvironment ) -> None :
9197 self .srcdir = app .srcdir
@@ -159,7 +165,7 @@ def get_target_uri(self, docname: str, typ: str | None = None) -> str:
159165 def get_relative_uri (self , from_ : str , to : str , typ : str | None = None ) -> str :
160166 """Return a relative URI between two source filenames.
161167
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.
163169 """
164170 return relative_uri (
165171 self .get_target_uri (from_ ),
@@ -789,7 +795,16 @@ def copy_assets(self) -> None:
789795 pass
790796
791797 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+ """
793808 raise NotImplementedError
794809
795810 def write_doc_serialized (self , docname : str , doctree : nodes .document ) -> None :
0 commit comments