summaryrefslogtreecommitdiff
path: root/sphinx/ext/mathbase.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2018-09-21 23:43:05 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2018-09-21 23:44:11 +0900
commitae12f357c7b620c5a8bff5b46532532ec3d8c301 (patch)
tree1ba501af22c5c71120c1c196fcf8472aab4865c8 /sphinx/ext/mathbase.py
parentb87d339b726152937abd0f118599b904b5d9ca76 (diff)
downloadsphinx-git-ae12f357c7b620c5a8bff5b46532532ec3d8c301.tar.gz
Fix #5463: mathbase: math_role and MathDirective was disappeared in 1.8.0
Diffstat (limited to 'sphinx/ext/mathbase.py')
-rw-r--r--sphinx/ext/mathbase.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/sphinx/ext/mathbase.py b/sphinx/ext/mathbase.py
index 58525f0cf..421ea6a03 100644
--- a/sphinx/ext/mathbase.py
+++ b/sphinx/ext/mathbase.py
@@ -12,10 +12,12 @@
import warnings
from docutils import nodes
+from docutils.parsers.rst.roles import math_role as math_role_base
from sphinx.addnodes import math, math_block as displaymath # NOQA # to keep compatibility
from sphinx.builders.latex.nodes import math_reference as eqref # NOQA # to keep compatibility
from sphinx.deprecation import RemovedInSphinx30Warning
+from sphinx.directives.patches import MathDirective as MathDirectiveBase
from sphinx.domains.math import MathDomain # NOQA # to keep compatibility
from sphinx.domains.math import MathReferenceRole as EqXRefRole # NOQA # to keep compatibility
@@ -26,6 +28,21 @@ if False:
from sphinx.application import Sphinx # NOQA
+class MathDirective(MathDirectiveBase):
+ def run(self):
+ warnings.warn('sphinx.ext.mathbase.MathDirective is moved to '
+ 'sphinx.directives.patches package.',
+ RemovedInSphinx30Warning)
+ return super(MathDirective, self).run()
+
+
+def math_role(role, rawtext, text, lineno, inliner, options={}, content=[]):
+ warnings.warn('sphinx.ext.mathbase.math_role() is deprecated. '
+ 'Please use docutils.parsers.rst.roles.math_role() instead.',
+ RemovedInSphinx30Warning)
+ return math_role_base(role, rawtext, text, lineno, inliner, options, content)
+
+
def get_node_equation_number(writer, node):
# type: (Writer, nodes.Node) -> unicode
warnings.warn('sphinx.ext.mathbase.get_node_equation_number() is moved to '