version 1.309, 2004/03/09 20:37:58
|
version 1.313, 2004/03/23 00:47:48
|
Line 401 sub latex_special_symbols {
|
Line 401 sub latex_special_symbols {
|
my ($string,$where)=@_; |
my ($string,$where)=@_; |
if ($where eq 'header') { |
if ($where eq 'header') { |
$string =~ s/(\\|_|\^)/ /g; |
$string =~ s/(\\|_|\^)/ /g; |
$string =~ s/(\$|%|\#|&|\{|\})/\\$1/g; |
$string =~ s/(\$|%|\{|\})/\\$1/g; |
$string =~ s/_/ /g; |
$string =~ s/_/ /g; |
|
$string=&Apache::lonprintout::character_chart($string); |
|
# any & or # leftover should be safe to just escape |
|
$string=~s/([^\\])\&/$1\\\&/g; |
|
$string=~s/([^\\])\#/$1\\\#/g; |
} else { |
} else { |
$string=~s/\\ /\\char92 /g; |
$string=~s/\\/\\ensuremath{\\backslash}/g; |
$string=~s/\^/\\\^\\strut /g; |
$string=~s/([^\\]|^)\%/$1\\\%/g; |
$string=~s/\~/\\char126 /g; |
$string=~s/([^\\]|^)(\$|_)/$1\\$2/g; |
#fixup & if it doesn't look like |
$string=~s/\$\$/\$\\\$/g; |
# { or α |
$string=~s/\#\#/\#\\\#/g; |
$string=~s/(&(?!((\#[0-9]+)|([a-z][a-z0-9]*));))/\\$1/gi; |
$string=~s/([^\\]|^)(\~|\^)/$1\\$2\\strut /g; |
$string=~s/([^&\\])\#/$1\\#/g; |
$string=~s/(>|<)/\\ensuremath\{$1\}/g; #more or less |
$string=~s/\#\#/\#\\#/g; |
$string=&Apache::lonprintout::character_chart($string); |
$string=~s/(\$|_|{|})/\\$1/g; |
# any & or # leftover should be safe to just escape |
$string=~s/\\char92 /\\texttt{\\char92}/g; |
$string=~s/([^\\]|^)\&/$1\\\&/g; |
$string=~s/(>|<)/\$$1\$/g; #more or less |
$string=~s/([^\\]|^)\#/$1\\\#/g; |
if ($string=~m/\d%/) {$string =~ s/(\d)%/$1\\%/g;} #percent after digit |
#single { or } How to escape? |
if ($string=~m/\s%/) {$string =~ s/(\s)%/$1\\%/g;} #percent after space |
|
if ($string eq '%.') {$string = '\%.';} #percent at the end of statement |
|
} |
} |
return $string; |
return $string; |
} |
} |
Line 751 sub init_safespace {
|
Line 753 sub init_safespace {
|
$safehole->wrap(\&Math::Random::random_get_seed,$safeeval,'&random_get_seed'); |
$safehole->wrap(\&Math::Random::random_get_seed,$safeeval,'&random_get_seed'); |
$safehole->wrap(\&Math::Random::random_set_seed,$safeeval,'&random_set_seed'); |
$safehole->wrap(\&Math::Random::random_set_seed,$safeeval,'&random_set_seed'); |
$safehole->wrap(\&Apache::lonxml::error,$safeeval,'&LONCAPA_INTERNAL_ERROR'); |
$safehole->wrap(\&Apache::lonxml::error,$safeeval,'&LONCAPA_INTERNAL_ERROR'); |
|
$safehole->wrap(\&Apache::lonxml::debug,$safeeval,'&LONCAPA_INTERNAL_DEBUG'); |
|
|
#need to inspect this class of ops |
#need to inspect this class of ops |
# $safeeval->deny(":base_orig"); |
# $safeeval->deny(":base_orig"); |