Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ubmarco committed Nov 9, 2023
1 parent 4ef08dd commit 82dabc3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions doc/extdev/builderapi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Builder API
.. autoattribute:: supported_remote_images
.. autoattribute:: supported_data_uri_images
.. autoattribute:: default_translator_class
.. autoattribute:: post_transform_merge_attr

These methods are predefined and will be called from the application:

Expand All @@ -37,6 +38,7 @@ Builder API
.. automethod:: get_target_uri
.. automethod:: prepare_writing
.. automethod:: write_doc
.. automethod:: merge_builder_post_transform
.. automethod:: finish

**Attributes**
Expand Down
15 changes: 9 additions & 6 deletions sphinx/builders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class Builder:
supported_data_uri_images = False
#: Builder attributes that should be returned from parallel
#: post transformation, to be merged to the main builder in
#: :py:class:`~sphinx.builders.Builder.merge_builder_post_transform`.
#: merge_builder_post_transform(). Attributes in the list must
#: be pickleable. The approach improves performance when
#: pickling and sending data over pipes because only a
Expand Down Expand Up @@ -135,14 +136,16 @@ def init(self) -> None:

def merge_builder_post_transform(self, new_attrs: dict[str, Any]) -> None:
"""Give builders the option to merge any parallel post-transform
information to the main builder. This can be useful for the
build-finish phase. The function is called once for each finished
subprocess. Builders that implements this function should also
define the class attribute post_transform_merge_attr.
information back to the main builder. This can be useful for
extensions that consume that information in the build-finish phase.
The function is called once for each finished
subprocess. Builders that implement this function must also
define the class attribute
:py:attr:`~sphinx.builders.Builder.post_transform_merge_attr`.
The default implementation does nothing.
param new_attrs: the attributes from the parallel subprocess to be
udpated in the main builder (self)
:param new_attrs: the attributes from the parallel subprocess to be
udpated in the main builder
"""
pass

Expand Down

0 comments on commit 82dabc3

Please sign in to comment.