Georg Brandl avatar Georg Brandl committed 8f8eb46

Added :confval:`pngmath_add_tooltips`.

Comments (0)

Files changed (3)

 * autodoc now supports documenting the signatures of ``functools.partial``
   objects.
 
+* Added :confval:`pngmath_add_tooltips`.
+
 * C++ domain now supports array definitions.
 
 
    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
 -------------------------------------------------------

sphinx/ext/pngmath.py

         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 ''
 
         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):
         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
 
 
                          ['-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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.