summaryrefslogtreecommitdiff
path: root/sphinx/ext/pngmath.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2016-04-28 00:16:42 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2016-04-28 00:17:14 +0900
commitb15da477467f22207869f246c77423f6c561e862 (patch)
treee7d1f358e3bbbf09657f5822e4c0daa854f53ea3 /sphinx/ext/pngmath.py
parentd0d2636c39aa3bba766f64a36a1083ad6a7a651e (diff)
downloadsphinx-git-b15da477467f22207869f246c77423f6c561e862.tar.gz
Show error reason when multiple math extensions are loaded (ref: #2499)
Diffstat (limited to 'sphinx/ext/pngmath.py')
-rw-r--r--sphinx/ext/pngmath.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/sphinx/ext/pngmath.py b/sphinx/ext/pngmath.py
index a2801bd1f..8707ca383 100644
--- a/sphinx/ext/pngmath.py
+++ b/sphinx/ext/pngmath.py
@@ -23,7 +23,7 @@ from six import text_type
from docutils import nodes
import sphinx
-from sphinx.errors import SphinxError
+from sphinx.errors import SphinxError, ExtensionError
from sphinx.util.png import read_png_depth, write_png_depth
from sphinx.util.osutil import ensuredir, ENOENT, cd
from sphinx.util.pycompat import sys_encoding
@@ -239,7 +239,11 @@ def html_visit_displaymath(self, node):
def setup(app):
app.warn('sphinx.ext.pngmath has been deprecated. Please use sphinx.ext.imgmath instead.')
- mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
+ try:
+ mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
+ except ExtensionError:
+ raise ExtensionError('sphinx.ext.mathjax: other math package is already installed')
+
app.add_config_value('pngmath_dvipng', 'dvipng', 'html')
app.add_config_value('pngmath_latex', 'latex', 'html')
app.add_config_value('pngmath_use_preview', False, 'html')