Commits

Kamil Kisiel committed e84e96a

Escape parentheses in wiki syntax regexp.

Comments (0)

Files changed (1)

tracmathjax/tracmathjax.py

 from trac.web.chrome import ITemplateProvider, add_script
 from trac.wiki.api import IWikiSyntaxProvider, IWikiMacroProvider
 import os.path
-        
+
 MACRO_DESCRIPTION = \
 """Renders a LaTeX using MathJax.
 
 MATHJAX_DIR = "MathJax"
 MATHJAX_JS = "MathJax.js"
 
+WIKI_RE = r"(?P<mathjax_inline>\\\(.*?\\\)|\$\$.*?\$\$)"
+
+
 class TracMathJax(Component):
-    implements(ITemplateProvider, 
-               IRequestFilter, 
+    implements(ITemplateProvider,
+               IRequestFilter,
                IWikiSyntaxProvider,
                IWikiMacroProvider)
 
     def get_wiki_syntax(self):
         # Capture text in between MathJax delimiters to keep other wiki syntax
         # from being applied.
-        yield (r"(?P<mathjax_inline>\\(.*?\\)|\$\$.*?\$\$)", self._render_inline)
+        yield (WIKI_RE, self._render_inline)
 
     def get_link_resolvers(self):
         # we have no link resolvers