The backslash issue was resolved in python-markdown 2.1.1, updated the dependencies and removed workaround

master
Stefan Krulj 15 years ago
parent 04eae687b0
commit 5a20003666
  1. 13
      mdx_math.py

@ -4,17 +4,16 @@ def makeExtension(configs=None) :
from markdown.inlinepatterns import Pattern from markdown.inlinepatterns import Pattern
import markdown, urllib import markdown, urllib
class MathPattern(Pattern): class MathPattern(Pattern):
def __init__(self,md): def __init__(self,md):
Pattern.__init__(self,"!\[math\]\((.*?)\)",md) Pattern.__init__(self,"!\[math\]\((.*?)\)\[math\]",md)
def handleMatch(self, m): def handleMatch(self, m):
texcode=m.group(2).replace("\x02klzzwxh:0000\x03","\\") #silly issue texcode=m.group(2)
el = markdown.etree.Element('img')
el.attrib["src"]="mimetex.cgi?"+\ el = markdown.util.etree.Element('img')
urllib.urlencode({'':texcode})[1:] el.attrib["src"]="tex.cgi?"+self.unescape(texcode)
el.attrib["alt"]=texcode el.attrib["alt"]=self.unescape(texcode)
return el return el
class MathExtension(markdown.Extension): class MathExtension(markdown.Extension):

Loading…
Cancel
Save