summaryrefslogtreecommitdiff
path: root/sphinx/addnodes.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/addnodes.py')
-rw-r--r--sphinx/addnodes.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/sphinx/addnodes.py b/sphinx/addnodes.py
index e6999bd16..56f23bba3 100644
--- a/sphinx/addnodes.py
+++ b/sphinx/addnodes.py
@@ -9,8 +9,12 @@
:license: BSD, see LICENSE for details.
"""
+import warnings
+
from docutils import nodes
+from sphinx.deprecation import RemovedInSphinx30Warning
+
if False:
# For type annotation
from typing import List, Sequence # NOQA
@@ -183,6 +187,27 @@ class production(nodes.Part, nodes.Inline, nodes.FixedTextElement):
"""Node for a single grammar production rule."""
+# math node
+
+
+class math(nodes.math):
+ """Node for inline equations.
+
+ .. deprecated:: 1.8
+ Use ``docutils.nodes.math`` instead.
+ """
+
+ def __getitem__(self, key):
+ """Special accessor for supporting ``node['latex']``."""
+ if key == 'latex' and 'latex' not in self.attributes:
+ warnings.warn("math node for Sphinx was replaced by docutils'. "
+ "Therefore please use ``node.astext()`` to get an equation instead.",
+ RemovedInSphinx30Warning)
+ return self.astext()
+ else:
+ return nodes.math.__getitem__(self, key)
+
+
# other directive-level nodes
class index(nodes.Invisible, nodes.Inline, nodes.TextElement):