--- loncom/xml/londefdef.pm 2004/02/19 19:57:48 1.199 +++ loncom/xml/londefdef.pm 2004/03/31 05:24:00 1.204 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.199 2004/02/19 19:57:48 albertel Exp $ +# $Id: londefdef.pm,v 1.204 2004/03/31 05:24:00 albertel Exp $ # # # Copyright Michigan State University Board of Trustees @@ -117,11 +117,8 @@ sub start_m { sub end_m { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web') { - $Apache::lonxml::prevent_entity_encode--; - } elsif ($target eq 'tex') { + if ($target eq 'tex') { $currentstring = ""; - } elsif ($target eq 'meta') { } return $currentstring; } @@ -393,7 +390,7 @@ sub start_meta { my $display=&Apache::lonxml::get_param ('display',$parstack,$safeeval,undef,1); if ($display) { - $display=&HTML::Entities::encode($display); + $display=&HTML::Entities::encode($display,'<>&"'); $currentstring.='<'.$name.'.display>'.$display. ''; } @@ -535,12 +532,13 @@ sub start_body { if ($ENV{'request.state'} ne 'published') { $currentstring.=(< - + EDITBUTTON } else { $currentstring.=&Apache::lonmenu::menubuttons(undef,$target,1); } + $currentstring.=&Apache::lonxml::message_location(); } elsif ($target eq 'tex') { $currentstring = '\begin{document}'; } @@ -1246,9 +1244,7 @@ sub start_font { my $currentstring = ''; if ($target eq 'web') { my $face=&Apache::lonxml::get_param('face',$parstack,$safeeval); - if ($face=~/symbol/i) { - $Apache::lonxml::prevent_entity_encode++; - } else { + if ($face!~/symbol/i) { if (($ENV{'browser.fontenhance'} eq 'on') || ($ENV{'browser.blackwhite'} eq 'on')) { return ''; } } @@ -1266,8 +1262,6 @@ sub end_font { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $currentstring = ''; if ($target eq 'web') { - my $face=&Apache::lonxml::get_param('face',$parstack,$safeeval); - if ($face=~/symbol/i) {$Apache::lonxml::prevent_entity_encode--;} $currentstring = $token->[2]; } elsif ($target eq 'tex') { my $fontsize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval); @@ -1337,7 +1331,7 @@ sub start_sub { if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "\$_{"; + $currentstring .= '\ensuremath{_{'; } return $currentstring; } @@ -1348,7 +1342,7 @@ sub end_sub { if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - $currentstring .= "}\$"; + $currentstring .= '}}'; } return $currentstring; } @@ -1360,7 +1354,7 @@ sub start_sup { if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "\$^{"; + $currentstring .= '\ensuremath{^{'; } return $currentstring; } @@ -1371,7 +1365,7 @@ sub end_sup { if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - $currentstring .= "}\$"; + $currentstring .= '}}'; } return $currentstring; } @@ -1794,13 +1788,14 @@ sub start_table { if (not defined $TeXwidth) { my $htmlwidth = &Apache::lonxml::get_param('width',$parstack,$safeeval,undef,1); if ($htmlwidth=~/%/) { + $Apache::londefdef::table[-1]{'percent'}=1; $htmlwidth=~/(\d+)/; - my $value=$1*$textwidth/100; - $Apache::londefdef::table[-1]{'width'}=$value; + $Apache::londefdef::table[-1]{'width'}=$1*$textwidth/100;; } else { $Apache::londefdef::table[-1]{'width'}=$textwidth; } } elsif ($TeXwidth=~/%/) { + $Apache::londefdef::table[-1]{'percent'}=1; $TeXwidth=~/(\d+)/; my $value=$1*$textwidth/100; $Apache::londefdef::table[-1]{'width'}=$value; @@ -1880,6 +1875,17 @@ sub end_table { $length_row_final[$jn]=0.9*$available_length/$needed; } } + #recalculation for the use of all available width if width is defined in % + if ($Apache::londefdef::table[-1]{'percent'}==1) { + my $current=0; + for (my $i=0;$i<=$#length_row_final;$i++) { + $current+=$length_row_final[$i]; + } + my $coef=$Apache::londefdef::table[-1]{'width'}/$current; + for (my $i=0;$i<=$#length_row_final;$i++) { + $length_row_final[$i]*=$coef; + } + } #fill the table for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) { for (my $jn=0;$jn<=$#length_row_final;$jn++) {