From: <ds...@us...> - 2008-05-30 17:29:27
|
Revision: 5325 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5325&view=rev Author: dsdale Date: 2008-05-30 10:29:25 -0700 (Fri, 30 May 2008) Log Message: ----------- temporary hack to make mathpng extension work with the way we organized doc/ Modified Paths: -------------- trunk/matplotlib/doc/sphinxext/mathpng.py Modified: trunk/matplotlib/doc/sphinxext/mathpng.py =================================================================== --- trunk/matplotlib/doc/sphinxext/mathpng.py 2008-05-30 17:11:35 UTC (rev 5324) +++ trunk/matplotlib/doc/sphinxext/mathpng.py 2008-05-30 17:29:25 UTC (rev 5325) @@ -100,6 +100,7 @@ for i in range(count): if os.path.exists(path): break path = '../'+path + path = '../'+path #specifically added for matplotlib if inline and '_' in latex: align = 'align="absmiddle" ' else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <md...@us...> - 2008-06-17 16:11:48
|
Revision: 5580 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5580&view=rev Author: mdboom Date: 2008-06-17 09:10:17 -0700 (Tue, 17 Jun 2008) Log Message: ----------- Fixing baseline alignment -- the align="absmiddle" hack is removed. 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:08:18 UTC (rev 5579) +++ trunk/matplotlib/doc/sphinxext/mathpng.py 2008-06-17 16:10:17 UTC (rev 5580) @@ -142,10 +142,6 @@ if os.path.exists(path): break path = '../'+path path = '../'+path #specifically added for matplotlib - if inline and '_' in latex: - align = 'align="absmiddle" ' - else: - align = '' if inline: cls = '' else: @@ -155,5 +151,5 @@ else: style = '' - return '<img src="%s/%s.png" %s%s%s/>' % (path, name, align, cls, style) + return '<img src="%s/%s.png" %s%s/>' % (path, name, cls, style) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-06-17 17:23:14
|
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. |
From: <md...@us...> - 2008-06-17 19:01:43
|
Revision: 5584 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5584&view=rev Author: mdboom Date: 2008-06-17 12:01:38 -0700 (Tue, 17 Jun 2008) Log Message: ----------- Make mathtext slightly smaller. Modified Paths: -------------- trunk/matplotlib/doc/sphinxext/mathpng.py Modified: trunk/matplotlib/doc/sphinxext/mathpng.py =================================================================== --- trunk/matplotlib/doc/sphinxext/mathpng.py 2008-06-17 18:02:08 UTC (rev 5583) +++ trunk/matplotlib/doc/sphinxext/mathpng.py 2008-06-17 19:01:38 UTC (rev 5584) @@ -117,11 +117,11 @@ orig_fontset = rcParams['mathtext.fontset'] rcParams['mathtext.fontset'] = fontset if os.path.exists(filename): - depth = mathtext_parser.get_depth(latex, dpi=120) + depth = mathtext_parser.get_depth(latex, dpi=100) else: print latex.encode("ascii", "backslashreplace") try: - depth = mathtext_parser.to_png(filename, latex, dpi=120) + depth = mathtext_parser.to_png(filename, latex, dpi=100) except: warnings.warn("Could not render math expression %s" % latex, Warning) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |