File: markdown_api.patch

package info (click to toggle)
python-pweave 0.30.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,068 kB
  • sloc: python: 30,281; makefile: 167
file content (38 lines) | stat: -rw-r--r-- 1,476 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From: Dmitry Shachnev <mitya57@debian.org>
Date: Mon, 18 Jul 2022 13:41:51 +0300
Subject: Adjust for API changes in Python-Markdown 3.0

Support for old deprecated API was removed in Python-Markdown 3.4.

Forwarded: https://github.com/mpastell/Pweave/pull/167
---
 pweave/markdownmath.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Index: python-pweave/pweave/formatters/markdownmath.py
===================================================================
--- python-pweave.orig/pweave/formatters/markdownmath.py	2023-01-31 13:02:12.658424192 +0100
+++ python-pweave/pweave/formatters/markdownmath.py	2023-01-31 13:10:03.962850623 +0100
@@ -1,3 +1,4 @@
+from xml.etree.ElementTree import Element
 import markdown
 
 
@@ -6,7 +7,7 @@
         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 @@
 
 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)