Merge branch '6.0.x'

# Conflicts:
#	CHANGES
This commit is contained in:
Adam Turner 2023-01-05 12:07:18 +00:00
commit 2c104e9838
3 changed files with 11 additions and 18 deletions

16
CHANGES
View File

@ -68,26 +68,18 @@ Bugs fixed
Testing Testing
-------- --------
Release 6.0.1 (in development) Release 6.0.1 (released Jan 05, 2023)
============================== =====================================
Dependencies Dependencies
------------ ------------
Incompatible changes * Require Pygments 2.13 or later.
--------------------
Deprecated
----------
Features added
--------------
Bugs fixed Bugs fixed
---------- ----------
Testing * #10944: imgmath: Fix resolving image paths for files in nested folders.
--------
Release 6.0.0 (released Dec 29, 2022) Release 6.0.0 (released Dec 29, 2022)
===================================== =====================================

View File

@ -30,11 +30,11 @@ __display_version__ = __version__ # used for command line version
#: #:
#: .. versionadded:: 1.2 #: .. versionadded:: 1.2
#: Before version 1.2, check the string ``sphinx.__version__``. #: Before version 1.2, check the string ``sphinx.__version__``.
version_info = (6, 0, 1, 'beta', 0) version_info = (6, 0, 1, 'final', 0)
package_dir = path.abspath(path.dirname(__file__)) package_dir = path.abspath(path.dirname(__file__))
_in_development = True _in_development = False
if _in_development: if _in_development:
# Only import subprocess if needed # Only import subprocess if needed
import subprocess import subprocess

View File

@ -209,10 +209,9 @@ def render_math(
"""Render the LaTeX math expression *math* using latex and dvipng or """Render the LaTeX math expression *math* using latex and dvipng or
dvisvgm. dvisvgm.
Return the filename relative to the built document and the "depth", Return the image absolute filename and the "depth",
that is, the distance of image bottom and baseline in pixels, if the that is, the distance of image bottom and baseline in pixels, if the
option to use preview_latex is switched on. option to use preview_latex is switched on.
Also return the temporary and destination files.
Error handling may seem strange, but follows a pattern: if LaTeX or dvipng Error handling may seem strange, but follows a pattern: if LaTeX or dvipng
(dvisvgm) aren't available, only a warning is generated (since that enables (dvisvgm) aren't available, only a warning is generated (since that enables
@ -319,7 +318,8 @@ def html_visit_math(self: HTML5Translator, node: nodes.math) -> None:
image_format = self.builder.config.imgmath_image_format.lower() image_format = self.builder.config.imgmath_image_format.lower()
img_src = render_maths_to_base64(image_format, rendered_path) img_src = render_maths_to_base64(image_format, rendered_path)
else: else:
relative_path = path.relpath(rendered_path, self.builder.outdir) bname = path.basename(rendered_path)
relative_path = path.join(self.builder.imgpath, 'math', bname)
img_src = relative_path.replace(path.sep, '/') img_src = relative_path.replace(path.sep, '/')
c = f'<img class="math" src="{img_src}"' + get_tooltip(self, node) c = f'<img class="math" src="{img_src}"' + get_tooltip(self, node)
if depth is not None: if depth is not None:
@ -359,7 +359,8 @@ def html_visit_displaymath(self: HTML5Translator, node: nodes.math_block) -> Non
image_format = self.builder.config.imgmath_image_format.lower() image_format = self.builder.config.imgmath_image_format.lower()
img_src = render_maths_to_base64(image_format, rendered_path) img_src = render_maths_to_base64(image_format, rendered_path)
else: else:
relative_path = path.relpath(rendered_path, self.builder.outdir) bname = path.basename(rendered_path)
relative_path = path.join(self.builder.imgpath, 'math', bname)
img_src = relative_path.replace(path.sep, '/') img_src = relative_path.replace(path.sep, '/')
self.body.append(f'<img src="{img_src}"' + get_tooltip(self, node) + self.body.append(f'<img src="{img_src}"' + get_tooltip(self, node) +
'/></p>\n</div>') '/></p>\n</div>')