--- loncom/xml/lonxml.pm 2016/02/20 00:12:45 1.555 +++ loncom/xml/lonxml.pm 2017/09/24 01:52:53 1.558 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.555 2016/02/20 00:12:45 raeburn Exp $ +# $Id: lonxml.pm,v 1.558 2017/09/24 01:52:53 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -69,6 +69,7 @@ use Safe(); use Safe::Hole(); use Math::Cephes(); use Math::Random(); +use Math::Calculus::Expression(); use Opcode(); use POSIX qw(strftime); use Time::HiRes qw( gettimeofday tv_interval ); @@ -345,9 +346,9 @@ sub latex_special_symbols { } else { $string=~s/\\/\\ensuremath{\\backslash}/g; $string=~s/\\\%|\%/\\\%/g; - $string=~s/\\{|{/\\{/g; + $string=~s/\\\{|\{/\\{/g; $string=~s/\\}|}/\\}/g; - $string=~s/\\ensuremath\\{\\backslash\\}/\\ensuremath{\\backslash}/g; + $string=~s/\\ensuremath\\\{\\backslash\\}/\\ensuremath{\\backslash}/g; $string=~s/\\\$|\$/\\\$/g; $string=~s/\\\_|\_/\\\_/g; $string=~s/([^\\]|^)(\~|\^)/$1\\$2\\strut /g; @@ -819,6 +820,7 @@ sub init_safespace { $safehole->wrap(\&Apache::functionplotresponse::fpr_objectcoords,$safeeval,'&fpr_objectcoords'); $safehole->wrap(\&Apache::functionplotresponse::fpr_vectorlength,$safeeval,'&fpr_vectorlength'); $safehole->wrap(\&Apache::functionplotresponse::fpr_vectorangle,$safeeval,'&fpr_vectorangle'); + $safehole->wrap(\&Math::Calculus::Expression::math_calculus_expression,$safeeval,'&math_calculus_expression'); # use Data::Dumper; # $safehole->wrap(\&Data::Dumper::Dumper,$safeeval,'&LONCAPA_INTERNAL_Dumper'); @@ -991,7 +993,7 @@ sub decreasedepth { sub get_id { my ($parstack,$safeeval)=@_; my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval); - if ($env{'request.state'} eq 'construct' && $id =~ /([._]|[^\w\d\s[:punct:]])/) { + if ($env{'request.state'} eq 'construct' && $id =~ /([._]|[^\w\s\-])/) { &error(&mt('ID [_1] contains invalid characters. IDs are only allowed to contain letters, numbers, spaces and -','"'.$id.'"')); } if ($id =~ /^\s*$/) { $id = $Apache::lonxml::curdepth; }