--- loncom/xml/lonxml.pm 2003/05/29 18:41:04 1.259 +++ loncom/xml/lonxml.pm 2003/08/04 14:30:34 1.267 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.259 2003/05/29 18:41:04 albertel Exp $ +# $Id: lonxml.pm,v 1.267 2003/08/04 14:30:34 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -70,6 +70,7 @@ use Math::Cephes(); use Math::Random(); use Opcode(); + sub register { my ($space,@taglist) = @_; foreach my $temptag (@taglist) { @@ -95,6 +96,8 @@ use Apache::run(); use Apache::londefdef(); use Apache::scripttag(); use Apache::edit(); +use Apache::inputtags(); +use Apache::outputtags(); use Apache::lonnet(); use Apache::File(); use Apache::loncommon(); @@ -151,6 +154,10 @@ $Apache::lonxml::counter_changed=0; #internal check on whether to look at style defs $Apache::lonxml::usestyle=1; +#locations used to store the parameter string for style substitutions +$Apache::lonxml::style_values=''; +$Apache::lonxml::style_end_values=''; + sub xmlbegin { my $output=''; if ($ENV{'browser.mathml'}) { @@ -382,7 +389,7 @@ sub fontsettings() { if (($ENV{'browser.os'} eq 'mac') && (!$ENV{'browser.mathml'})) { $headerstring.= ''; - } elsif (!$ENV{'browser.mathml'}) { + } elsif (!$ENV{'browser.mathml'} && $ENV{'browser.unicode'}) { $headerstring.= ''; } @@ -485,6 +492,7 @@ sub latex_special_symbols { $current_token=~s/(>|<)/\$$1\$/g; #more or less if ($current_token=~m/\d%/) {$current_token =~ s/(\d)%/$1\\%/g;} #percent after digit if ($current_token=~m/\s%/) {$current_token =~ s/(\s)%/$1\\%/g;} #persent after space + if ($current_token eq '%.') {$current_token = '\%.';} #persent at the end of statement } return $current_token; } @@ -497,7 +505,7 @@ sub inner_xmlparse { my $dontpop=0; while ( $#$pars > -1 ) { while ($token = $$pars['-1']->get_token) { - if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) { + if (($token->[0] eq 'T') || ($token->[0] eq 'C') ) { if ($metamode<1) { my $text=$token->[1]; if ($token->[0] eq 'C' && $target eq 'tex') { @@ -506,8 +514,13 @@ sub inner_xmlparse { } $result.=$text; } + } elsif (($token->[0] eq 'D')) { + if ($metamode<1 && $target eq 'web') { + my $text=$token->[1]; + $result.=$text; + } } elsif ($token->[0] eq 'PI') { - if ($metamode<1) { + if ($metamode<1 && $target eq 'web') { $result=$token->[2]; } } elsif ($token->[0] eq 'S') { @@ -1037,7 +1050,7 @@ sub parstring { my $val=$token->[2]->{$_}; $val =~ s/([\%\@\\\"\'])/\\$1/g; #if ($val =~ m/^[\%\@]/) { $val="\\".$val; } - $temp .= "my \$$_=\"$val\";" + $temp .= "my \$$_=\"$val\";"; } } return $temp; @@ -1130,13 +1143,7 @@ sub inserteditinfo { my ($result,$filecontents)=@_; $filecontents = &HTML::Entities::encode($filecontents); # my $editheader='Edit below
'; - my $xml_help = '
'. - &Apache::loncommon::help_open_topic("Greek_Symbols",'Greek Symbols', - undef,undef,600) - .''. - &Apache::loncommon::help_open_topic("Other_Symbols",'Other Symbols', - undef,undef,600) - .'
'; + my $xml_help = Apache::loncommon::helpLatexCheatsheet(); my $titledisplay=&display_title(); my $buttons=(<WARNING:".join('
',@_)."
\n"; + + if ($ENV{'form.grade_target'} ne 'tex') { + if ($ENV{'request.state'} eq 'construct' || $Apache::lonxml::debug) { + print "WARNING:".join('
',@_)."
\n"; + } } } @@ -1426,6 +1440,7 @@ sub description { # calls to lonnet functions for this setup. # - looks for form.grade_ parameters sub whichuser { + my ($passedsymb)=@_; my ($symb,$courseid,$domain,$name,$publicuser); if (defined($ENV{'form.grade_symb'})) { my $tmp_courseid=$ENV{'form.grade_courseid'}; @@ -1437,7 +1452,11 @@ sub whichuser { $name=$ENV{'form.grade_username'}; } } else { - $symb=&Apache::lonnet::symbread(); + if (!$passedsymb) { + $symb=&Apache::lonnet::symbread(); + } else { + $symb=$passedsymb; + } $courseid=$ENV{'request.course.id'}; $domain=$ENV{'user.domain'}; $name=$ENV{'user.name'};