--- loncom/xml/lonxml.pm 2017/12/06 14:23:44 1.531.2.23 +++ loncom/xml/lonxml.pm 2018/09/14 21:41:13 1.531.2.24 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.531.2.23 2017/12/06 14:23:44 raeburn Exp $ +# $Id: lonxml.pm,v 1.531.2.24 2018/09/14 21:41:13 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -70,6 +70,7 @@ use Safe::Hole(); use Math::Cephes(); use Math::Random(); use Math::Calculus::Expression(); +use Number::FormatEng(); use Opcode(); use POSIX qw(strftime); use Time::HiRes qw( gettimeofday tv_interval ); @@ -441,7 +442,7 @@ 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/\\\$|\$/\\\$/g; @@ -916,6 +917,8 @@ sub init_safespace { $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'); + $safehole->wrap(\&Number::FormatEng::format_eng,$safeeval,'&number_format_eng'); + $safehole->wrap(\&Number::FormatEng::format_pref,$safeeval,'&number_format_pref'); # use Data::Dumper; # $safehole->wrap(\&Data::Dumper::Dumper,$safeeval,'&LONCAPA_INTERNAL_Dumper'); @@ -1088,7 +1091,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; } @@ -2364,7 +2367,7 @@ sub register_insert { sub dump_insertlist { my ($ext) = @_; - open(XML,">/tmp/insertlist.xml.$ext"); + open(XML,">","/tmp/insertlist.xml.$ext"); print XML (""); my $i=0;