File markdown.patch of Package python-Pweave
From d956f7d02105a4ae734a8713f5e10a956fbbe5c8 Mon Sep 17 00:00:00 2001
From: Dmitry Shachnev <mitya57@gmail.com>
Date: Mon, 18 Jul 2022 13:50:12 +0300
Subject: [PATCH] Adjust for API changes in Python-Markdown 3.0
Support for old deprecated API was removed in Python-Markdown 3.4.
---
pweave/formatters/markdownmath.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/pweave/formatters/markdownmath.py b/pweave/formatters/markdownmath.py
index 5a9c629..f665160 100644
--- a/pweave/formatters/markdownmath.py
+++ b/pweave/formatters/markdownmath.py
@@ -1,3 +1,4 @@
+from xml.etree.ElementTree import Element
import markdown
@@ -6,7 +7,7 @@ def __init__(self):
markdown.inlinepatterns.Pattern.__init__(self, r'(?<!\\)(\$\$?)(.+?)\2')
def handleMatch(self, m):
- node = markdown.util.etree.Element('span class="math"')
+ node = Element('span class="math"')
# node.text = markdown.util.AtomicString(m.group(2) + m.group(3) + m.group(2))
if m.group(2) == "$$":
node.text = markdown.util.AtomicString("\[" + m.group(3) + "\]")
@@ -17,5 +18,5 @@ def handleMatch(self, m):
class MathExtension(markdown.Extension):
- def extendMarkdown(self, md, md_globals):
- md.inlinePatterns.add('math', MathPattern(), '<escape')
\ No newline at end of file
+ def extendMarkdown(self, md):
+ md.inlinePatterns.register(MathPattern(), 'math', 185)