From: <md...@us...> - 2008-06-17 14:46:45
|
Revision: 5572 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5572&view=rev Author: mdboom Date: 2008-06-17 07:46:00 -0700 (Tue, 17 Jun 2008) Log Message: ----------- Warn when a math expression can not be rendered, rather than hard-failing. Modified Paths: -------------- trunk/matplotlib/doc/sphinxext/mathpng.py Modified: trunk/matplotlib/doc/sphinxext/mathpng.py =================================================================== --- trunk/matplotlib/doc/sphinxext/mathpng.py 2008-06-17 14:42:31 UTC (rev 5571) +++ trunk/matplotlib/doc/sphinxext/mathpng.py 2008-06-17 14:46:00 UTC (rev 5572) @@ -8,6 +8,7 @@ from docutils.parsers.rst import directives from docutils.writers.html4css1 import HTMLTranslator from sphinx.latexwriter import LaTeXTranslator +import warnings # Define LaTeX math node: class latex_math(nodes.General, nodes.Element): @@ -116,7 +117,11 @@ return orig_fontset = rcParams['mathtext.fontset'] rcParams['mathtext.fontset'] = fontset - mathtext_parser.to_png(filename, "$%s$" % latex, dpi=120) + try: + mathtext_parser.to_png(filename, "$%s$" % latex, dpi=120) + except: + warnings.warn("Could not render math expression $%s$" % latex, + warnings.Warning) rcParams['mathtext.fontset'] = orig_fontset # LaTeX to HTML translation stuff: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |