From 5a20003666652cc44d8603aa7cf1702977ffb43b Mon Sep 17 00:00:00 2001 From: Stefan Krulj Date: Thu, 15 Mar 2012 17:01:58 +0100 Subject: [PATCH] The backslash issue was resolved in python-markdown 2.1.1, updated the dependencies and removed workaround --- mdx_math.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mdx_math.py b/mdx_math.py index 920b917..50aa4d6 100644 --- a/mdx_math.py +++ b/mdx_math.py @@ -4,17 +4,16 @@ def makeExtension(configs=None) : from markdown.inlinepatterns import Pattern import markdown, urllib - class MathPattern(Pattern): def __init__(self,md): - Pattern.__init__(self,"!\[math\]\((.*?)\)",md) + Pattern.__init__(self,"!\[math\]\((.*?)\)\[math\]",md) def handleMatch(self, m): - texcode=m.group(2).replace("\x02klzzwxh:0000\x03","\\") #silly issue - el = markdown.etree.Element('img') - el.attrib["src"]="mimetex.cgi?"+\ - urllib.urlencode({'':texcode})[1:] + texcode=m.group(2) + + el = markdown.util.etree.Element('img') + el.attrib["src"]="tex.cgi?"+self.unescape(texcode) - el.attrib["alt"]=texcode + el.attrib["alt"]=self.unescape(texcode) return el class MathExtension(markdown.Extension):