--- loncom/xml/lonxml.pm 2003/04/03 21:58:09 1.244 +++ loncom/xml/lonxml.pm 2003/05/02 19:57:01 1.250 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.244 2003/04/03 21:58:09 albertel Exp $ +# $Id: lonxml.pm,v 1.250 2003/05/02 19:57:01 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -380,8 +380,11 @@ sub printtokenheader { sub fontsettings() { my $headerstring=''; if (($ENV{'browser.os'} eq 'mac') && (!$ENV{'browser.mathml'})) { - $headerstring.= - ''; + $headerstring.= + ''; + } elsif (!$ENV{'browser.mathml'}) { + $headerstring.= + ''; } return $headerstring; } @@ -475,7 +478,7 @@ sub latex_special_symbols { $current_token=~s/\\ /\\char92 /g; $current_token=~s/\^/\\char94 /g; $current_token=~s/\~/\\char126 /g; - $current_token=~s/(&[^a-z\#])/\\$1/g; + $current_token=~s/(&[^A-Za-z\#])/\\$1/g; $current_token=~s/([^&])\#/$1\\#/g; $current_token=~s/(\$|_|{|})/\\$1/g; $current_token=~s/\\char92 /\\texttt{\\char92}/g; @@ -557,9 +560,10 @@ sub inner_xmlparse { } } if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) { - if ($target eq 'tex') { - $result=&latex_special_symbols($result,$stack,$parstack); - } + #Style file definitions should be correct + if ($target eq 'tex' && ($Apache::lonxml::usestyle)) { + $result=&latex_special_symbols($result,$stack,$parstack); + } } # Encode any high ASCII characters @@ -799,6 +803,7 @@ sub init_safespace { my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser(); $rndseed=&Apache::lonnet::rndseed($symb,$courseid,$domain,$name); $safeinit .= ';$external::randomseed='.$rndseed.';'; + &Apache::lonxml::debug("Setting rndseed to $rndseed"); &Apache::run::run($safeinit,$safeeval); } @@ -898,18 +903,23 @@ sub get_all_text_unbalanced { } sub increment_counter { - $Apache::lonxml::counter++; + my ($increment) = @_; + if (defined($increment) && $increment gt 0) { + $Apache::lonxml::counter+=$increment; + } else { + $Apache::lonxml::counter++; + } $Apache::lonxml::counter_changed=1; } sub init_counter { if (defined($ENV{'form.counter'})) { $Apache::lonxml::counter=$ENV{'form.counter'}; + $Apache::lonxml::counter_changed=0; } else { $Apache::lonxml::counter=1; - &store_counter(); + $Apache::lonxml::counter_changed=1; } - $Apache::lonxml::counter_changed=0; } sub store_counter { @@ -1391,7 +1401,7 @@ sub description { # calls to lonnet functions for this setup. # - looks for form.grade_ parameters sub whichuser { - my ($symb,$courseid,$domain,$name); + my ($symb,$courseid,$domain,$name,$publicuser); if (defined($ENV{'form.grade_symb'})) { my $tmp_courseid=$ENV{'form.grade_courseid'}; my $allowed=&Apache::lonnet::allowed('mgr',$tmp_courseid); @@ -1413,7 +1423,7 @@ sub whichuser { $name.=$ENV{'form.username'}; } } - return ($symb,$courseid,$domain,$name); + return ($symb,$courseid,$domain,$name,$publicuser); } 1;