summaryrefslogtreecommitdiff
path: root/sphinx/ext/jsmath.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2018-01-22 22:05:38 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2018-02-04 15:14:51 +0900
commitdc2b153835af985c1bd940aa4116b78bf248b6e0 (patch)
tree29383d6007d2f13c517ae4646e639362017aa9d4 /sphinx/ext/jsmath.py
parent498fa379efe5b6b106c8d3eb56041164cdc8bab3 (diff)
downloadsphinx-git-dc2b153835af985c1bd940aa4116b78bf248b6e0.tar.gz
Update type annotations
Diffstat (limited to 'sphinx/ext/jsmath.py')
-rw-r--r--sphinx/ext/jsmath.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/sphinx/ext/jsmath.py b/sphinx/ext/jsmath.py
index 05d5dc290..b718162d2 100644
--- a/sphinx/ext/jsmath.py
+++ b/sphinx/ext/jsmath.py
@@ -19,13 +19,21 @@ from sphinx.ext.mathbase import setup_math as mathbase_setup
from sphinx.locale import _
+if False:
+ # For type annotation
+ from typing import Any, Dict # NOQA
+ from sphinx.application import Sphinx # NOQA
+
+
def html_visit_math(self, node):
+ # type: (nodes.NodeVisitor, nodes.Node) -> None
self.body.append(self.starttag(node, 'span', '', CLASS='math notranslate'))
self.body.append(self.encode(node['latex']) + '</span>')
raise nodes.SkipNode
def html_visit_displaymath(self, node):
+ # type: (nodes.NodeVisitor, nodes.Node) -> None
if node['nowrap']:
self.body.append(self.starttag(node, 'div', CLASS='math notranslate'))
self.body.append(self.encode(node['latex']))
@@ -53,6 +61,7 @@ def html_visit_displaymath(self, node):
def builder_inited(app):
+ # type: (Sphinx) -> None
if not app.config.jsmath_path:
raise ExtensionError('jsmath_path config value must be set for the '
'jsmath extension to work')
@@ -60,6 +69,7 @@ def builder_inited(app):
def setup(app):
+ # type: (Sphinx) -> Dict[unicode, Any]
try:
mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
except ExtensionError: