/usr/lib/python3/dist-packages/pweave/markdownmath.py is in python3-pweave 0.25-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import markdown
class MathPattern(markdown.inlinepatterns.Pattern):
def __init__(self):
markdown.inlinepatterns.Pattern.__init__(self, r'(?<!\\)(\$\$?)(.+?)\2')
def handleMatch(self, m):
node = markdown.util.etree.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) + "\]")
else:
node.text = markdown.util.AtomicString("\(" + m.group(3) + "\)")
return node
class MathExtension(markdown.Extension):
def extendMarkdown(self, md, md_globals):
md.inlinePatterns.add('math', MathPattern(), '<escape')
|