@@ -2811,6 +2811,8 @@ def setUp(self):
28112811 display_name = 'Vertical with No Mathjax HTML' ,
28122812 )
28132813 MATHJAX_TAG_PAIRS = [
2814+ ("$" , "$" ),
2815+ ("$$" , "$$" ),
28142816 (r"\(" , r"\)" ),
28152817 (r"\[" , r"\]" ),
28162818 ("[mathjaxinline]" , "[/mathjaxinline]" ),
@@ -2831,6 +2833,12 @@ def setUp(self):
28312833 display_name = "HTML Without Mathjax" ,
28322834 data = "<p>I talk about mathjax, but I have no actual Math!</p>" ,
28332835 )
2836+ self .html_with_lone_dollar = BlockFactory .create (
2837+ category = 'html' ,
2838+ parent_location = self .no_math_vertical .location ,
2839+ display_name = "HTML With Lone Dollar" ,
2840+ data = "<p>Price: $5</p>" ,
2841+ )
28342842
28352843 self .course_key = self .course .id
28362844 self .user = UserFactory (username = 'staff_user' , profile__country = 'AX' , is_staff = True )
@@ -2849,6 +2857,8 @@ def test_mathjax_detection(self):
28492857 response = self .client .get (url )
28502858 assert response .status_code == 200
28512859 assert b"window.MathJax" in response .content
2860+ assert b"['$', '$']" in response .content
2861+ assert b"['$$', '$$']" in response .content
28522862
28532863 # Check the one without Math...
28542864 url = reverse ("render_xblock" , kwargs = {
@@ -2858,6 +2868,14 @@ def test_mathjax_detection(self):
28582868 assert response .status_code == 200
28592869 assert b"window.MathJax" not in response .content
28602870
2871+ # Check lone dollar sign isn't mistaken for MathJax
2872+ url = reverse ("render_xblock" , kwargs = {
2873+ 'usage_key_string' : str (self .html_with_lone_dollar .location )
2874+ })
2875+ response = self .client .get (url )
2876+ assert response .status_code == 200
2877+ assert b"window.MathJax" not in response .content
2878+
28612879 # The containing vertical should still return MathJax (for now)
28622880 url = reverse ("render_xblock" , kwargs = {
28632881 'usage_key_string' : str (self .no_math_vertical .location )
0 commit comments