--- loncom/xml/lonxml.pm 2002/07/24 20:25:23 1.184
+++ loncom/xml/lonxml.pm 2002/08/28 17:07:54 1.189
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.184 2002/07/24 20:25:23 www Exp $
+# $Id: lonxml.pm,v 1.189 2002/08/28 17:07:54 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -176,6 +176,7 @@ sub xmlend {
unless (($hidden) && (!$seeid)) {
my $message=$contrib{$idx.':message'};
$message=~s/\n/\
/g;
+ $message=&Apache::lontexconvert::msgtexconverted($message);
if ($message) {
if ($hidden) {
$message=''.$message.'';
@@ -332,7 +333,8 @@ sub registerurl {
my $target = shift;
my $result = '';
if ($target eq 'edit') {
- $result .="\n";
}
@@ -537,6 +539,24 @@ sub htmlclean {
return $output;
}
+sub latex_special_sumbols {
+ my ($current_token,$stack,$parstack)=@_;
+ my @temp_array = @$stack;
+ if ($temp_array[-1] ne 'tt') {
+ if ($current_token=~m/\^/) {$current_token=~s/\^/\\verb|\^|/g;}
+ } else {
+ if ($current_token=~m/\^/) {$current_token=~s/\^/}\\verb|\^|{/g;}
+ }
+ if ($current_token=~m/>/) {$current_token=~s/>/\$>\$/g;} #more
+ if ($current_token=~m/) {$current_token=~s/\$<\$/g;} #less
+ if ($current_token=~m/\d%/) {$current_token =~ s/%/\\%/g;} #percent after digit
+ if ($current_token=~m/\s%/) {$current_token =~ s/%/\\%/g;} #persent after space
+
+
+# $current_token = ' start='.$current_token.'=finish ';
+ return $current_token;
+}
+
sub inner_xmlparse {
my ($target,$stack,$parstack,$pars,$safeeval,$style_for_target)=@_;
my $finaloutput = '';
@@ -547,18 +567,15 @@ sub inner_xmlparse {
if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) {
if ($metamode<1) {
if ($target eq 'tex') {
- my @temp_array = @$stack;
- if ($temp_array[-1] ne 'm') {
- if ($temp_array[-1] ne 'tt') {
- if ($token->[1]=~m/\^/) {$token->[1]=~s/\^/\\verb|\^|/g;}
- } else {
- if ($token->[1]=~m/\^/) {$token->[1]=~s/\^/}\\verb|\^|{/g;}
- }
- if ($token->[1]=~m/>/) {$token->[1]=~s/>/\$>\$/g;}
- if ($token->[1]=~m/) {$token->[1]=~s/\$<\$/g;}
+ my $text=$token->[1];
+ if ($token->[0] eq 'C') {
+ $text = '%'.$text;
+ $text =~ s/[\n\r]//g;
}
+ $result.=&latex_special_sumbols($text,$stack,$parstack);
+ } else {
+ $result.=$token->[1];
}
- $result.=$token->[1];
}
} elsif ($token->[0] eq 'PI') {
if ($metamode<1) {
@@ -747,13 +764,13 @@ sub callsub {
}
if (!$deleted) {
if ($space) {
- #&Apache::lonxml::debug("Calling sub $sub in $space $metamode");
+ &Apache::lonxml::debug("Calling sub $sub in $space $metamode");
$sub1="$space\:\:$sub";
($currentstring,$nodefault) = &$sub1($target,$token,$tagstack,
$parstack,$parser,$safeeval,
$style);
} else {
- #&Apache::lonxml::debug("NOT Calling sub $sub in $space $metamode");
+ &Apache::lonxml::debug("NOT Calling sub $sub in $space $metamode");
if ($metamode <1) {
if (defined($token->[4]) && ($metamode < 1)) {
$currentstring = $token->[4];