version 1.189, 2002/08/28 17:07:54
|
version 1.192, 2002/09/04 06:55:27
|
Line 539 sub htmlclean {
|
Line 539 sub htmlclean {
|
return $output; |
return $output; |
} |
} |
|
|
sub latex_special_sumbols { |
sub latex_special_symbols { |
my ($current_token,$stack,$parstack)=@_; |
my ($current_token,$stack,$parstack)=@_; |
my @temp_array = @$stack; |
$current_token=~s/\\/\\char92 /g; |
if ($temp_array[-1] ne 'tt') { |
$current_token=~s/\^/\\char94 /g; |
if ($current_token=~m/\^/) {$current_token=~s/\^/\\verb|\^|/g;} |
$current_token=~s/\~/\\char126 /g; |
} else { |
$current_token=~s/(&[^a-z#])/\\$1/g; |
if ($current_token=~m/\^/) {$current_token=~s/\^/}\\verb|\^|{/g;} |
$current_token=~s/([^&]\#)/\\$1/g; |
} |
$current_token=~s/(\$|_|{|})/\\$1/g; |
if ($current_token=~m/>/) {$current_token=~s/>/\$>\$/g;} #more |
$current_token=~s/\\char92 /\\texttt{\\char92}/g; |
if ($current_token=~m/</) {$current_token=~s/</\$<\$/g;} #less |
$current_token=~s/>/\$>\$/g; #more |
if ($current_token=~m/\d%/) {$current_token =~ s/%/\\%/g;} #percent after digit |
$current_token=~s/</\$<\$/g; #less |
if ($current_token=~m/\s%/) {$current_token =~ s/%/\\%/g;} #persent after space |
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 |
|
|
# $current_token = ' start='.$current_token.'=finish '; |
|
return $current_token; |
return $current_token; |
} |
} |
|
|
Line 566 sub inner_xmlparse {
|
Line 564 sub inner_xmlparse {
|
while ($token = $$pars['-1']->get_token) { |
while ($token = $$pars['-1']->get_token) { |
if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) { |
if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) { |
if ($metamode<1) { |
if ($metamode<1) { |
if ($target eq 'tex') { |
my $text=$token->[1]; |
my $text=$token->[1]; |
if ($token->[0] eq 'C') { |
if ($token->[0] eq 'C') { |
$text = '%'.$text; |
$text = '%'.$text; |
$text =~ s/[\n\r]//g; |
$text =~ s/[\n\r]//g; |
|
} |
|
$result.=&latex_special_sumbols($text,$stack,$parstack); |
|
} else { |
|
$result.=$token->[1]; |
|
} |
} |
|
$result.=$text; |
} |
} |
} elsif ($token->[0] eq 'PI') { |
} elsif ($token->[0] eq 'PI') { |
if ($metamode<1) { |
if ($metamode<1) { |
Line 638 sub inner_xmlparse {
|
Line 632 sub inner_xmlparse {
|
$result= &Apache::run::evaluate($result,$safeeval,''); |
$result= &Apache::run::evaluate($result,$safeeval,''); |
} |
} |
} |
} |
|
if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) { |
|
if ($target eq 'tex') { |
|
$result=&latex_special_symbols($result,$stack,$parstack); |
|
} |
|
} |
|
|
# Encode any high ASCII characters |
# Encode any high ASCII characters |
if (!$Apache::lonxml::prevent_entity_encode) { |
if (!$Apache::lonxml::prevent_entity_encode) { |
$result=&HTML::Entities::encode($result,"\200-\377"); |
$result=&HTML::Entities::encode($result,"\200-\377"); |
Line 963 sub decreasedepth {
|
Line 963 sub decreasedepth {
|
} |
} |
|
|
sub get_all_text_unbalanced { |
sub get_all_text_unbalanced { |
|
#there is a copy of this in lonpublisher.pm |
my($tag,$pars)= @_; |
my($tag,$pars)= @_; |
my $token; |
my $token; |
my $result=''; |
my $result=''; |