mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Closes #923: Take the entire LaTeX document into account when caching
pngmath-generated images. This rebuilds them correctly when ``pngmath_latex_preamble`` changes.
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -39,6 +39,10 @@ Bugs fixed
|
||||
* #943: In autosummary, recognize "first sentences" to pull from the docstring
|
||||
if they contain uppercase letters.
|
||||
|
||||
* #923: Take the entire LaTeX document into account when caching
|
||||
pngmath-generated images. This rebuilds them correctly when
|
||||
``pngmath_latex_preamble`` changes.
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
|
||||
@@ -82,8 +82,10 @@ def render_math(self, math):
|
||||
may not fail since that indicates a problem in the math source.
|
||||
"""
|
||||
use_preview = self.builder.config.pngmath_use_preview
|
||||
latex = DOC_HEAD + self.builder.config.pngmath_latex_preamble
|
||||
latex += (use_preview and DOC_BODY_PREVIEW or DOC_BODY) % math
|
||||
|
||||
shasum = "%s.png" % sha(math.encode('utf-8')).hexdigest()
|
||||
shasum = "%s.png" % sha(latex.encode('utf-8')).hexdigest()
|
||||
relfn = posixpath.join(self.builder.imgpath, 'math', shasum)
|
||||
outfn = path.join(self.builder.outdir, '_images', 'math', shasum)
|
||||
if path.isfile(outfn):
|
||||
@@ -95,9 +97,6 @@ def render_math(self, math):
|
||||
hasattr(self.builder, '_mathpng_warned_dvipng'):
|
||||
return None, None
|
||||
|
||||
latex = DOC_HEAD + self.builder.config.pngmath_latex_preamble
|
||||
latex += (use_preview and DOC_BODY_PREVIEW or DOC_BODY) % math
|
||||
|
||||
# use only one tempdir per build -- the use of a directory is cleaner
|
||||
# than using temporary files, since we can clean up everything at once
|
||||
# just removing the whole directory (see cleanup_tempdir)
|
||||
|
||||
Reference in New Issue
Block a user