Diff for /loncom/xml/lonxml.pm between versions 1.291 and 1.297

version 1.291, 2003/11/06 19:24:11 version 1.297, 2004/01/21 02:33:05
Line 167  $Apache::lonxml::style_end_values=''; Line 167  $Apache::lonxml::style_end_values='';
 #should we do the postag variable interpolation  #should we do the postag variable interpolation
 $Apache::lonxml::post_evaluate=1;  $Apache::lonxml::post_evaluate=1;
   
   #a header message to emit in the case of any generated warning or errors
   $Apache::lonxml::warnings_error_header='';
   
 sub xmlbegin {  sub xmlbegin {
   my $output='';    my $output='';
   if ($ENV{'browser.mathml'}) {    if ($ENV{'browser.mathml'}) {
Line 337  sub xmlparse { Line 340  sub xmlparse {
                           &Apache::style::styleparser($target,$styletext));                            &Apache::style::styleparser($target,$styletext));
        }         }
     }      }
  } elsif ($ENV{'construction_space_style'} && ($ENV{'request.state'} eq 'construct')) {   } elsif ($ENV{'construct.style'} && ($ENV{'request.state'} eq 'construct')) {
      my $location=&Apache::lonnet::filelocation('',$ENV{'construction_space_style'});       my $location=&Apache::lonnet::filelocation('',$ENV{'construct.style'});
      my $styletext=&Apache::lonnet::getfile($location);       my $styletext=&Apache::lonnet::getfile($location);
        if ($styletext ne '-1') {         if ($styletext ne '-1') {
           %style_for_target = (%style_for_target,            %style_for_target = (%style_for_target,
Line 404  sub latex_special_symbols { Line 407  sub latex_special_symbols {
  $string=~s/\\ /\\char92 /g;   $string=~s/\\ /\\char92 /g;
  $string=~s/\^/\\\^ /g;   $string=~s/\^/\\\^ /g;
  $string=~s/\~/\\char126 /g;   $string=~s/\~/\\char126 /g;
  $string=~s/(&[^A-Za-z\#])/\\$1/g;   #fixup & if it doesn't look like
           # { or α
    $string=~s/(&(?!((\#[0-9]+)|([a-z]+));))/\\$1/gi;
  $string=~s/([^&])\#/$1\\#/g;   $string=~s/([^&])\#/$1\\#/g;
  $string=~s/(\$|_|{|})/\\$1/g;   $string=~s/(\$|_|{|})/\\$1/g;
  $string=~s/\\char92 /\\texttt{\\char92}/g;   $string=~s/\\char92 /\\texttt{\\char92}/g;
Line 623  sub setup_globals { Line 628  sub setup_globals {
   @Apache::lonxml::extlinks=();    @Apache::lonxml::extlinks=();
   @Apache::lonxml::ssi_info=();    @Apache::lonxml::ssi_info=();
   $Apache::lonxml::post_evaluate=1;    $Apache::lonxml::post_evaluate=1;
     $Apache::lonxml::warnings_error_header='';
   if ($target eq 'meta') {    if ($target eq 'meta') {
     $Apache::lonxml::redirection = 0;      $Apache::lonxml::redirection = 0;
     $Apache::lonxml::metamode = 1;      $Apache::lonxml::metamode = 1;
Line 1298  sub error { Line 1304  sub error {
   $errorcount++;    $errorcount++;
   if (($Apache::lonxml::debug eq 1) || ($ENV{'request.state'} eq 'construct') ) {    if (($Apache::lonxml::debug eq 1) || ($ENV{'request.state'} eq 'construct') ) {
     # If printing in construction space, put the error inside <pre></pre>      # If printing in construction space, put the error inside <pre></pre>
     print "<b>ERROR:</b>".join("\n",@_)."\n";        print $Apache::lonxml::warnings_error_header.
     "<b>ERROR:</b>".join("\n",@_)."\n";
         $Apache::lonxml::warnings_error_header='';
   } else {    } else {
     print "<b>An Error occured while processing this resource. The instructor has been notified.</b> <br />";      print "<b>An Error occured while processing this resource. The instructor has been notified.</b> <br />";
     #notify author      #notify author
Line 1321  sub error { Line 1329  sub error {
 }  }
   
 sub warning {  sub warning {
   $warningcount++;      $warningcount++;
       
   if ($ENV{'form.grade_target'} ne 'tex') {      if ($ENV{'form.grade_target'} ne 'tex') {
       if ($ENV{'request.state'} eq 'construct' || $Apache::lonxml::debug) {   if ($ENV{'request.state'} eq 'construct' || $Apache::lonxml::debug) {
         print "<b>W</b>ARNING<b>:</b>".join('<br />',@_)."<br />\n";      print $Apache::lonxml::warnings_error_header.
       }   "<b>W</b>ARNING<b>:</b>".join('<br />',@_)."<br />\n";
   }      $Apache::lonxml::warnings_error_header='';
    }
       }
 }  }
   
 sub get_param {  sub get_param {
Line 1335  sub get_param { Line 1345  sub get_param {
     if ( ! $context ) { $context = -1; }      if ( ! $context ) { $context = -1; }
     my $args ='';      my $args ='';
     if ( $#$parstack > (-2-$context) ) { $args=$$parstack[$context]; }      if ( $#$parstack > (-2-$context) ) { $args=$$parstack[$context]; }
       if ( ! $Apache::lonxml::usestyle ) {
    $args=$Apache::lonxml::style_values.$args;
       }
     if ( ! $args ) { return undef; }      if ( ! $args ) { return undef; }
     if ( $case_insensitive ) {      if ( $case_insensitive ) {
  if ($args =~ s/(my \$)(\Q$param\E)(=\")/$1.lc($2).$3/ei) {   if ($args =~ s/(my \$)(\Q$param\E)(=\")/$1.lc($2).$3/ei) {
Line 1358  sub get_param_var { Line 1371  sub get_param_var {
   if ( ! $context ) { $context = -1; }    if ( ! $context ) { $context = -1; }
   my $args ='';    my $args ='';
   if ( $#$parstack > (-2-$context) ) { $args=$$parstack[$context]; }    if ( $#$parstack > (-2-$context) ) { $args=$$parstack[$context]; }
     if ( ! $Apache::lonxml::usestyle ) {
         $args=$Apache::lonxml::style_values.$args;
     }
   &Apache::lonxml::debug("Args are $args param is $param");    &Apache::lonxml::debug("Args are $args param is $param");
   if ($case_insensitive) {    if ($case_insensitive) {
       if (! ($args=~s/(my \$)(\Q$param\E)(=\")/$1.lc($2).$3/ei)) {        if (! ($args=~s/(my \$)(\Q$param\E)(=\")/$1.lc($2).$3/ei)) {

Removed from v.1.291  
changed lines
  Added in v.1.297


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>