[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 23 Mar 2004 00:47:48 -0000
albertel Mon Mar 22 19:47:48 2004 EDT
Modified files:
/loncom/xml lonxml.pm
Log:
- the character to escape might be the first caharacter on the line
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.312 loncom/xml/lonxml.pm:1.313
--- loncom/xml/lonxml.pm:1.312 Fri Mar 19 17:06:53 2004
+++ loncom/xml/lonxml.pm Mon Mar 22 19:47:48 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.312 2004/03/19 22:06:53 albertel Exp $
+# $Id: lonxml.pm,v 1.313 2004/03/23 00:47:48 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -409,16 +409,16 @@
$string=~s/([^\\])\#/$1\\\#/g;
} else {
$string=~s/\\/\\ensuremath{\\backslash}/g;
- $string=~s/([^\\])\%/$1\\\%/g;
- $string=~s/([^\\])(\$|_)/$1\\$2/g;
+ $string=~s/([^\\]|^)\%/$1\\\%/g;
+ $string=~s/([^\\]|^)(\$|_)/$1\\$2/g;
$string=~s/\$\$/\$\\\$/g;
$string=~s/\#\#/\#\\\#/g;
- $string=~s/([^\\])(\~|\^)/$1\\$2\\strut /g;
+ $string=~s/([^\\]|^)(\~|\^)/$1\\$2\\strut /g;
$string=~s/(>|<)/\\ensuremath\{$1\}/g; #more or less
$string=&Apache::lonprintout::character_chart($string);
# any & or # leftover should be safe to just escape
- $string=~s/([^\\])\&/$1\\\&/g;
- $string=~s/([^\\])\#/$1\\\#/g;
+ $string=~s/([^\\]|^)\&/$1\\\&/g;
+ $string=~s/([^\\]|^)\#/$1\\\#/g;
#single { or } How to escape?
}
return $string;