[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 27 Mar 2006 19:38:53 -0000


albertel		Mon Mar 27 14:38:53 2006 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
  Log:
  - take care of the case of a preexisting escaped \
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.322 loncom/interface/loncommon.pm:1.323
--- loncom/interface/loncommon.pm:1.322	Fri Mar 24 16:40:11 2006
+++ loncom/interface/loncommon.pm	Mon Mar 27 14:38:53 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.322 2006/03/24 21:40:11 albertel Exp $
+# $Id: loncommon.pm,v 1.323 2006/03/27 19:38:53 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3157,9 +3157,10 @@
 sub js_ready {
     my ($result) = @_;
 
-    $result =~ s/[\n\r]/ /g;
-    $result =~ s/'/\\'/g;
-    $result =~ s{</script>}{</scrip'+'t>}g;
+    $result =~ s/[\n\r]/ /xmsg;
+    $result =~ s/\\/\\\\/xmsg;
+    $result =~ s/'/\\'/xmsg;
+    $result =~ s{</script>}{</scrip'+'t>}xmsg;
     
     return $result;
 }