From 063a64bab08d7a515e8b314f2fea8a1288864a1d Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sat, 19 Oct 2024 21:11:26 +0100 Subject: [PATCH] Add `self.has_equations = True` to `{visit,depart}_math_block()` --- sphinx/writers/html5.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sphinx/writers/html5.py b/sphinx/writers/html5.py index 0b0d55858c5..e58182310f3 100644 --- a/sphinx/writers/html5.py +++ b/sphinx/writers/html5.py @@ -960,6 +960,7 @@ def visit_field(self, node: Element) -> None: def visit_math(self, node: Element, math_env: str = '') -> None: self.has_equations = True + # see validate_math_renderer name: str = self.builder.math_renderer_name # type: ignore[assignment] visit, _ = self.builder.app.registry.html_inline_math_renderers[name] @@ -967,6 +968,7 @@ def visit_math(self, node: Element, math_env: str = '') -> None: def depart_math(self, node: Element, math_env: str = '') -> None: self.has_equations = True + # see validate_math_renderer name: str = self.builder.math_renderer_name # type: ignore[assignment] _, depart = self.builder.app.registry.html_inline_math_renderers[name] @@ -974,12 +976,16 @@ def depart_math(self, node: Element, math_env: str = '') -> None: depart(self, node) def visit_math_block(self, node: Element, math_env: str = '') -> None: + self.has_equations = True + # see validate_math_renderer name: str = self.builder.math_renderer_name # type: ignore[assignment] visit, _ = self.builder.app.registry.html_block_math_renderers[name] visit(self, node) def depart_math_block(self, node: Element, math_env: str = '') -> None: + self.has_equations = True + # see validate_math_renderer name: str = self.builder.math_renderer_name # type: ignore[assignment] _, depart = self.builder.app.registry.html_block_math_renderers[name]