Skip to content

Commit 78a80b5

Browse files
committed
Stop using deprecated markdown.util.etree
See Python-Markdown/markdown#902.
1 parent bf2d5ad commit 78a80b5

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

mdx_math.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,23 @@
1010
Author: 2015-2020, Dmitry Shachnev <mitya57@gmail.com>.
1111
'''
1212

13+
from xml.etree.ElementTree import Element
1314
from markdown.inlinepatterns import InlineProcessor
1415
from markdown.extensions import Extension
15-
from markdown.util import AtomicString, etree
16+
from markdown.util import AtomicString
1617

1718

1819
def _wrap_node(node, preview_text, wrapper_tag):
19-
preview = etree.Element('span', {'class': 'MathJax_Preview'})
20+
preview = Element('span', {'class': 'MathJax_Preview'})
2021
preview.text = AtomicString(preview_text)
21-
wrapper = etree.Element(wrapper_tag)
22+
wrapper = Element(wrapper_tag)
2223
wrapper.extend([preview, node])
2324
return wrapper
2425

2526

2627
class InlineMathPattern(InlineProcessor):
2728
def handleMatch(self, m, data):
28-
node = etree.Element('script')
29+
node = Element('script')
2930
node.set('type', self._content_type)
3031
node.text = AtomicString(m.group(2))
3132
if self._add_preview:
@@ -35,7 +36,7 @@ def handleMatch(self, m, data):
3536

3637
class DisplayMathPattern(InlineProcessor):
3738
def handleMatch(self, m, data):
38-
node = etree.Element('script')
39+
node = Element('script')
3940
node.set('type', '%s; mode=display' % self._content_type)
4041
if '\\begin' in m.group(1):
4142
node.text = AtomicString(m.group(0))

0 commit comments

Comments
 (0)