--- loncom/xml/lonxml.pm 2003/08/13 14:23:37 1.271 +++ loncom/xml/lonxml.pm 2003/08/13 18:57:28 1.272 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.271 2003/08/13 14:23:37 www Exp $ +# $Id: lonxml.pm,v 1.272 2003/08/13 18:57:28 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -478,24 +478,24 @@ sub htmlclean { } sub latex_special_symbols { - my ($current_token,$stack,$parstack,$where)=@_; + my ($string,$where)=@_; if ($where eq 'header') { - $current_token =~ s/(\\|_|\^)/ /g; - $current_token =~ s/(\$|%|\#|&|\{|\})/\\$1/g; + $string =~ s/(\\|_|\^)/ /g; + $string =~ s/(\$|%|\#|&|\{|\})/\\$1/g; } else { - $current_token=~s/\\ /\\char92 /g; - $current_token=~s/\^/\\char94 /g; - $current_token=~s/\~/\\char126 /g; - $current_token=~s/(&[^A-Za-z\#])/\\$1/g; - $current_token=~s/([^&])\#/$1\\#/g; - $current_token=~s/(\$|_|{|})/\\$1/g; - $current_token=~s/\\char92 /\\texttt{\\char92}/g; - $current_token=~s/(>|<)/\$$1\$/g; #more or less - if ($current_token=~m/\d%/) {$current_token =~ s/(\d)%/$1\\%/g;} #percent after digit - if ($current_token=~m/\s%/) {$current_token =~ s/(\s)%/$1\\%/g;} #persent after space - if ($current_token eq '%.') {$current_token = '\%.';} #persent at the end of statement + $string=~s/\\ /\\char92 /g; + $string=~s/\^/\\char94 /g; + $string=~s/\~/\\char126 /g; + $string=~s/(&[^A-Za-z\#])/\\$1/g; + $string=~s/([^&])\#/$1\\#/g; + $string=~s/(\$|_|{|})/\\$1/g; + $string=~s/\\char92 /\\texttt{\\char92}/g; + $string=~s/(>|<)/\$$1\$/g; #more or less + if ($string=~m/\d%/) {$string =~ s/(\d)%/$1\\%/g;} #percent after digit + if ($string=~m/\s%/) {$string =~ s/(\s)%/$1\\%/g;} #percent after space + if ($string eq '%.') {$string = '\%.';} #percent at the end of statement } - return $current_token; + return $string; } sub inner_xmlparse { @@ -585,7 +585,7 @@ sub inner_xmlparse { if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) { #Style file definitions should be correct if ($target eq 'tex' && ($Apache::lonxml::usestyle)) { - $result=&latex_special_symbols($result,$stack,$parstack); + $result=&latex_special_symbols($result); } }