summaryrefslogtreecommitdiff
path: root/sphinx/ext/imgmath.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-07-05 01:32:54 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-07-05 01:32:54 +0900
commitec3754bd94eaa3aa3c5410ee6ab100bb27bfb798 (patch)
treed0446a967a4f8cbc3208d48d6bf3d9b7c90ca25e /sphinx/ext/imgmath.py
parentb268963709dc9256cf711d4cc054a86e70226702 (diff)
parent9fd9edebb47a3a5eda8c6065b12b71cdb0985a73 (diff)
downloadsphinx-git-ec3754bd94eaa3aa3c5410ee6ab100bb27bfb798.tar.gz
Merge branch '3.x'
Diffstat (limited to 'sphinx/ext/imgmath.py')
-rw-r--r--sphinx/ext/imgmath.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/sphinx/ext/imgmath.py b/sphinx/ext/imgmath.py
index 65f281223..a8da39709 100644
--- a/sphinx/ext/imgmath.py
+++ b/sphinx/ext/imgmath.py
@@ -137,13 +137,13 @@ def compile_math(latex: str, builder: Builder) -> str:
try:
subprocess.run(command, stdout=PIPE, stderr=PIPE, cwd=tempdir, check=True)
return path.join(tempdir, 'math.dvi')
- except OSError:
+ except OSError as exc:
logger.warning(__('LaTeX command %r cannot be run (needed for math '
'display), check the imgmath_latex setting'),
builder.config.imgmath_latex)
- raise InvokeError
+ raise InvokeError from exc
except CalledProcessError as exc:
- raise MathExtError('latex exited with error', exc.stderr, exc.stdout)
+ raise MathExtError('latex exited with error', exc.stderr, exc.stdout) from exc
def convert_dvi_to_image(command: List[str], name: str) -> Tuple[str, str]:
@@ -151,13 +151,13 @@ def convert_dvi_to_image(command: List[str], name: str) -> Tuple[str, str]:
try:
ret = subprocess.run(command, stdout=PIPE, stderr=PIPE, check=True, encoding='ascii')
return ret.stdout, ret.stderr
- except OSError:
+ except OSError as exc:
logger.warning(__('%s command %r cannot be run (needed for math '
'display), check the imgmath_%s setting'),
name, command[0], name)
- raise InvokeError
+ raise InvokeError from exc
except CalledProcessError as exc:
- raise MathExtError('%s exited with error' % name, exc.stderr, exc.stdout)
+ raise MathExtError('%s exited with error' % name, exc.stderr, exc.stdout) from exc
def convert_dvi_to_png(dvipath: str, builder: Builder) -> Tuple[str, int]:
@@ -298,7 +298,7 @@ def html_visit_math(self: HTMLTranslator, node: nodes.math) -> None:
backrefs=[], source=node.astext())
sm.walkabout(self)
logger.warning(__('display latex %r: %s'), node.astext(), msg)
- raise nodes.SkipNode
+ raise nodes.SkipNode from exc
if fname is None:
# something failed -- use text-only as a bad substitute
self.body.append('<span class="math">%s</span>' %
@@ -324,7 +324,7 @@ def html_visit_displaymath(self: HTMLTranslator, node: nodes.math_block) -> None
backrefs=[], source=node.astext())
sm.walkabout(self)
logger.warning(__('inline latex %r: %s'), node.astext(), msg)
- raise nodes.SkipNode
+ raise nodes.SkipNode from exc
self.body.append(self.starttag(node, 'div', CLASS='math'))
self.body.append('<p>')
if node['number']: