mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Added :confval:pngmath_add_tooltips
.
This commit is contained in:
parent
9088c2ffc2
commit
bc6b586836
2
CHANGES
2
CHANGES
@ -88,6 +88,8 @@ Release 1.1 (in development)
|
||||
* autodoc now supports documenting the signatures of ``functools.partial``
|
||||
objects.
|
||||
|
||||
* Added :confval:`pngmath_add_tooltips`.
|
||||
|
||||
* C++ domain now supports array definitions.
|
||||
|
||||
|
||||
|
@ -170,6 +170,13 @@ There are various config values you can set to influence how the images are buil
|
||||
Unfortunately, this only works when the `preview-latex package`_ is
|
||||
installed. Therefore, the default for this option is ``False``.
|
||||
|
||||
.. confval:: pngmath_add_tooltips
|
||||
|
||||
Default: true. If false, do not add the LaTeX code as an "alt" attribute for
|
||||
math images.
|
||||
|
||||
.. versionadded:: 1.1
|
||||
|
||||
|
||||
:mod:`sphinx.ext.mathjax` -- Render math via JavaScript
|
||||
-------------------------------------------------------
|
||||
|
@ -179,7 +179,7 @@ def cleanup_tempdir(app, exc):
|
||||
pass
|
||||
|
||||
def get_tooltip(self, node):
|
||||
if self.builder.config.pngmath_use_tooltips :
|
||||
if self.builder.config.pngmath_add_tooltips:
|
||||
return ' alt="%s"' % self.encode(node['latex']).strip()
|
||||
return ''
|
||||
|
||||
@ -198,12 +198,10 @@ def html_visit_math(self, node):
|
||||
self.body.append('<span class="math">%s</span>' %
|
||||
self.encode(node['latex']).strip())
|
||||
else:
|
||||
c = '<img class="math" src="%s"' % fname
|
||||
c += get_tooltip(self, node)
|
||||
if depth:
|
||||
c += ' style="vertical-align: %dpx"' % -depth
|
||||
c += '/>'
|
||||
self.body.append(c)
|
||||
c = ('<img class="math" src="%s"' % fname) + get_tooltip(self, node)
|
||||
if depth is not None:
|
||||
c += ' style="vertical-align: %dpx"' % (-depth)
|
||||
self.body.append(c + '/>')
|
||||
raise nodes.SkipNode
|
||||
|
||||
def html_visit_displaymath(self, node):
|
||||
@ -228,10 +226,8 @@ def html_visit_displaymath(self, node):
|
||||
self.body.append('<span class="math">%s</span></p>\n</div>' %
|
||||
self.encode(node['latex']).strip())
|
||||
else:
|
||||
c = '<img src="%s"' % fname
|
||||
c += get_tooltip(self, node)
|
||||
c += '/></p>\n</div>'
|
||||
self.body.append(c)
|
||||
self.body.append(('<img src="%s"' % fname) + get_tooltip(self, node)
|
||||
+ '/></p>\n</div>')
|
||||
raise nodes.SkipNode
|
||||
|
||||
|
||||
@ -244,5 +240,5 @@ def setup(app):
|
||||
['-gamma 1.5', '-D 110'], 'html')
|
||||
app.add_config_value('pngmath_latex_args', [], 'html')
|
||||
app.add_config_value('pngmath_latex_preamble', '', 'html')
|
||||
app.add_config_value('pngmath_use_tooltips', True, 'html')
|
||||
app.add_config_value('pngmath_add_tooltips', True, 'html')
|
||||
app.connect('build-finished', cleanup_tempdir)
|
||||
|
Loading…
Reference in New Issue
Block a user