Revision: 5581
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5581&view=rev
Author:   mdboom
Date:     2008-06-17 10:21:08 -0700 (Tue, 17 Jun 2008)

Log Message:
-----------
Bugfix for re-generating math images

Modified Paths:
--------------
    trunk/matplotlib/doc/sphinxext/mathpng.py

Modified: trunk/matplotlib/doc/sphinxext/mathpng.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/mathpng.py   2008-06-17 16:10:17 UTC (rev 
5580)
+++ trunk/matplotlib/doc/sphinxext/mathpng.py   2008-06-17 17:21:08 UTC (rev 
5581)
@@ -114,16 +114,18 @@
 # This uses mathtext to render the expression
 def latex2png(latex, filename, fontset='cm'):
     latex = "$%s$" % latex
-    if os.path.exists(filename):
-        return mathtext_parser.get_depth(latex, dpi=120)
     orig_fontset = rcParams['mathtext.fontset']
     rcParams['mathtext.fontset'] = fontset
-    try:
-        depth = mathtext_parser.to_png(filename, latex, dpi=120)
-    except:
-        warnings.warn("Could not render math expression %s" % latex,
-                      Warning)
-        depth = 0
+    if os.path.exists(filename):
+        depth = mathtext_parser.get_depth(latex, dpi=120)
+    else:
+        print latex.encode("ascii", "backslashreplace")
+        try:
+            depth = mathtext_parser.to_png(filename, latex, dpi=120)
+        except:
+            warnings.warn("Could not render math expression %s" % latex,
+                          Warning)
+            depth = 0
     rcParams['mathtext.fontset'] = orig_fontset
     return depth
 
@@ -131,7 +133,6 @@
 def latex2html(node, source):
     inline = isinstance(node.parent, nodes.TextElement)
     latex = node['latex']
-    print latex.encode("ascii", "backslashreplace")
     name = 'math-%s' % md5(latex).hexdigest()[-10:]
     dest = '_static/%s.png' % name
     depth = latex2png(latex, dest, node['fontset'])


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to