Commits

Kamil Kisiel committed 6b5d013

Added support for \[ .. \] block-level syntax

Comments (0)

Files changed (2)

         result1 = re.findall(tracmathjax.WIKI_RE, test_str1)
         self.assertEqual(result1, [r'$$ \alpha $$'])
 
+    def test_displaymath_brackets(self):
+        test_str1 = r"foo \[ \alpha \] bar"
+        result1 = re.findall(tracmathjax.WIKI_RE, test_str1)
+        self.assertEqual(result1, [r'\[ \alpha \]'])
+
 if __name__ == "__main__":
     unittest.main()

tracmathjax/tracmathjax.py

 MATHJAX_DIR = "MathJax"
 MATHJAX_JS = "MathJax.js"
 
-WIKI_RE = r"(?P<mathjax_inline>\\\(.*?\\\)|\$\$.*?\$\$)"
+#: Wiki syntax regular expression
+WIKI_RE = r"(?P<mathjax_inline>\\\(.*?\\\)|\$\$.*?\$\$|\\\[.*?\\\])"
 
 
 class TracMathJax(Component):