summaryrefslogtreecommitdiff
path: root/sphinx/ext/pngmath.py
diff options
context:
space:
mode:
authorRobert Lehmann <mail@robertlehmann.de>2013-01-02 17:45:33 +0100
committerRobert Lehmann <mail@robertlehmann.de>2013-01-02 17:45:33 +0100
commit0725cb608a9ca6de67d3e681acb51507c300936e (patch)
treee34d12e2493e12a7c68e3b43040bb2c664e6e8d3 /sphinx/ext/pngmath.py
parentebc953d15cf1ea583e1b79399fb074ad26f7c6ce (diff)
parent151856819c212229f6f58a8a2cbf9223a4191f94 (diff)
downloadsphinx-git-0725cb608a9ca6de67d3e681acb51507c300936e.tar.gz
merge with birkenfeld/sphinx
Diffstat (limited to 'sphinx/ext/pngmath.py')
-rw-r--r--sphinx/ext/pngmath.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/sphinx/ext/pngmath.py b/sphinx/ext/pngmath.py
index 549dfb83a..3938dab17 100644
--- a/sphinx/ext/pngmath.py
+++ b/sphinx/ext/pngmath.py
@@ -5,7 +5,7 @@
Render math in HTML via dvipng.
- :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
+ :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -32,6 +32,13 @@ from sphinx.ext.mathbase import setup_math as mathbase_setup, wrap_displaymath
class MathExtError(SphinxError):
category = 'Math extension error'
+ def __init__(self, msg, stderr=None, stdout=None):
+ if stderr:
+ msg += '\n[stderr]\n' + stderr
+ if stdout:
+ msg += '\n[stdout]\n' + stdout
+ SphinxError.__init__(self, msg)
+
DOC_HEAD = r'''
\documentclass[12pt]{article}
@@ -130,8 +137,7 @@ def render_math(self, math):
stdout, stderr = p.communicate()
if p.returncode != 0:
- raise MathExtError('latex exited with error:\n[stderr]\n%s\n'
- '[stdout]\n%s' % (stderr, stdout))
+ raise MathExtError('latex exited with error', stderr, stdout)
ensuredir(path.dirname(outfn))
# use some standard dvipng arguments
@@ -155,8 +161,7 @@ def render_math(self, math):
return None, None
stdout, stderr = p.communicate()
if p.returncode != 0:
- raise MathExtError('dvipng exited with error:\n[stderr]\n%s\n'
- '[stdout]\n%s' % (stderr, stdout))
+ raise MathExtError('dvipng exited with error', stderr, stdout)
depth = None
if use_preview:
for line in stdout.splitlines():