summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Turner <9087854+aa-turner@users.noreply.github.com>2023-01-02 15:02:33 +0000
committerAdam Turner <9087854+aa-turner@users.noreply.github.com>2023-01-02 17:41:13 +0000
commitb32841e153431ec02de31e9ec32e79ab3ac7d1c2 (patch)
treeeb1d2eba8432b342b289be2815c918b9d315303a
parent087522cf79b5e998c1e7b7350783accf328fecd1 (diff)
downloadsphinx-git-b32841e153431ec02de31e9ec32e79ab3ac7d1c2.tar.gz
Move tasks into parallel writing
-rw-r--r--sphinx/builders/html/__init__.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/sphinx/builders/html/__init__.py b/sphinx/builders/html/__init__.py
index 9c11e919a..fa39c695c 100644
--- a/sphinx/builders/html/__init__.py
+++ b/sphinx/builders/html/__init__.py
@@ -655,12 +655,18 @@ class StandaloneHTMLBuilder(Builder):
}
def write_doc(self, docname: str, doctree: nodes.document) -> None:
+ self.imgpath = relative_uri(self.get_target_uri(docname), self.imagedir)
+ self.post_process_images(doctree)
+
+ title_node = self.env.longtitles.get(docname)
+ title = self.render_partial(title_node)['title'] if title_node else ''
+ self.index_page(docname, doctree, title)
+
destination = StringOutput(encoding='utf-8')
doctree.settings = self.docsettings
self.secnumbers = self.env.toc_secnumbers.get(docname, {})
self.fignumbers = self.env.toc_fignumbers.get(docname, {})
- self.imgpath = relative_uri(self.get_target_uri(docname), '_images')
self.dlpath = relative_uri(self.get_target_uri(docname), '_downloads')
self.current_docname = docname
self.docwriter.write(doctree, destination)
@@ -671,13 +677,6 @@ class StandaloneHTMLBuilder(Builder):
ctx = self.get_doc_context(docname, body, metatags)
self.handle_page(docname, ctx, event_arg=doctree)
- def write_doc_serialized(self, docname: str, doctree: nodes.document) -> None:
- self.imgpath = relative_uri(self.get_target_uri(docname), self.imagedir)
- self.post_process_images(doctree)
- title_node = self.env.longtitles.get(docname)
- title = self.render_partial(title_node)['title'] if title_node else ''
- self.index_page(docname, doctree, title)
-
def finish(self) -> None:
self.finish_tasks.add_task(self.gen_indices)
self.finish_tasks.add_task(self.gen_pages_from_extensions)
@@ -904,7 +903,7 @@ class StandaloneHTMLBuilder(Builder):
"""Pick the best candidate for an image and link down-scaled images to
their high res version.
"""
- Builder.post_process_images(self, doctree)
+ super().post_process_images(doctree)
if self.config.html_scaled_image_link and self.html_scaled_image_link:
for node in doctree.findall(nodes.image):