--- loncom/xml/londefdef.pm 2006/03/29 23:00:51 1.302.2.5 +++ loncom/xml/londefdef.pm 2006/03/22 19:37:44 1.322 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.302.2.5 2006/03/29 23:00:51 albertel Exp $ +# $Id: londefdef.pm,v 1.322 2006/03/22 19:37:44 albertel Exp $ # # # Copyright Michigan State University Board of Trustees @@ -68,7 +68,6 @@ BEGIN { # for ($row =0; $row <= $lastrow; $row++ ) { # my $text = Dumper($Apache::londefdef::table[$row]); # &Apache::lonnet::logthis("table [ $row ]".$text); -# # } #} sub initialize_londefdef { @@ -106,11 +105,21 @@ sub start_m { $inside=&Apache::run::evaluate($inside,$safeeval,$$parstack[-1]); #&Apache::lonxml::debug("M is evaulated to:$inside:"); } + my $tex = $inside; my $display=&Apache::lonxml::get_param('display',$parstack,$safeeval); $currentstring = &Apache::lontexconvert::converted(\$inside,$display); if ($Apache::lontexconvert::errorstring) { - &Apache::lonxml::warning("tth error: ". - $Apache::lontexconvert::errorstring); + my $errormsg='
'.&HTML::Entities::encode($Apache::lontexconvert::errorstring,'<>&"').'
occured while attempting to convert this TeX:
';
+	    $tex = &HTML::Entities::encode($tex,'<>&"');
+	    my ($linenumber) =
+		($Apache::lontexconvert::errorstring =~ /Line (\d+)/);
+	    if (defined($linenumber)) {
+		my @tex=split("\n",$tex);
+		$tex[$linenumber]=''.
+		    $tex[$linenumber].'';
+		$tex=join("\n",@tex);
+	    }
+	    &Apache::lonxml::warning($errormsg.$tex.'
'); $Apache::lontexconvert::errorstring=''; } #&Apache::lonxml::debug("M is ends with:$currentstring:"); @@ -146,7 +155,7 @@ sub end_m { sub start_tthoption { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_; my $result; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { my $inside = &Apache::lonxml::get_all_text("/tthoption",$parser, $style); $inside=~s/^\s*//; @@ -174,11 +183,12 @@ sub start_html { if ($target eq 'web' || $target eq 'edit' || $target eq 'webgrade' ) { $currentstring = &Apache::lonxml::xmlbegin(); } elsif ($target eq 'tex') { - $currentstring .= '\documentclass[letterpaper]{article}'; + $currentstring .= '\documentclass[letterpaper,twoside]{article}'; if (($env{'form.latex_type'}=~'batchmode') || (!$env{'request.role.adv'})) {$currentstring .='\batchmode';} $currentstring .= '\newcommand{\keephidden}[1]{}'. '\renewcommand{\deg}{$^{\circ}$}'. + '\usepackage{multirow}'. '\usepackage{longtable}'. '\usepackage{textcomp}'. '\usepackage{makeidx}'. @@ -201,7 +211,7 @@ sub start_html { sub end_html { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = ''; } return $currentstring; @@ -211,7 +221,7 @@ sub end_html { sub start_head { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4].&Apache::lonxml::fontsettings(); } return $currentstring; @@ -220,8 +230,7 @@ sub start_head { sub end_head { my ($target,$token) = @_; my $currentstring = ''; - if (($target eq 'web' && $env{'request.state'} eq 'published') || - ($target eq 'webgrade' && $env{'request.state'} eq 'published')) { + if ($target eq 'web' && $env{'request.state'} eq 'published') { $currentstring = &Apache::lonmenu::registerurl(undef,$target). $token->[2]; } @@ -232,7 +241,7 @@ sub end_head { sub start_map { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -241,7 +250,7 @@ sub start_map { sub end_map { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -251,7 +260,7 @@ sub end_map { sub start_select { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { $Apache::londefdef::select=0; @@ -262,7 +271,7 @@ sub start_select { sub end_select { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -272,7 +281,7 @@ sub end_select { sub start_option { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { $Apache::londefdef::select++; @@ -288,7 +297,7 @@ sub start_option { sub end_option { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $currentstring='}'; @@ -300,7 +309,7 @@ sub end_option { sub start_input { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -309,7 +318,7 @@ sub start_input { sub end_input { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -319,7 +328,7 @@ sub end_input { sub start_textarea { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -328,7 +337,7 @@ sub start_textarea { sub end_textarea { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -338,7 +347,7 @@ sub end_textarea { sub start_form { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -347,7 +356,7 @@ sub start_form { sub end_form { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -357,7 +366,7 @@ sub end_form { sub start_title { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\keephidden{Title of the document: ' @@ -372,7 +381,7 @@ sub start_title { sub end_title { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}'; @@ -388,7 +397,7 @@ sub end_title { sub start_meta { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { my $args=''; if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; } if ($args eq '') { @@ -437,7 +446,7 @@ sub start_meta { sub end_meta { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { my $args=''; if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; } if ($args ne '') { @@ -503,7 +512,7 @@ sub start_body { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { if ($Apache::lonhomework::parsing_a_problem) { &Apache::lonxml::warning(" tag found inside of tag this can cause problems."); return ''; @@ -587,7 +596,7 @@ EDITBUTTON sub end_body { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = &end_p(); # Close off unclosed

- if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= &Apache::lonxml::xmlend($target,$parser); } elsif ($target eq 'tex') { $currentstring .= '\strut\newline\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\newline\noindent \end{document}'; @@ -602,7 +611,7 @@ sub center_correction { return '\vspace* sub start_center { my ($target,$token,$tagstack) = @_; my $currentstring = &end_p(); # Close off any prior para. - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { if (&is_inside_of($tagstack, "table")) { @@ -616,13 +625,10 @@ sub start_center { sub end_center { my ($target,$token,$tagstack) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $currentstring = '\end{center}'; - if (&is_inside_of($tagstack, "table")) { - #$currentstring .= ¢er_correction(); - } } return $currentstring; } @@ -632,7 +638,7 @@ sub end_center { sub start_b { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { &disable_para(); @@ -644,7 +650,7 @@ sub start_b { sub end_b { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { &enable_para(); @@ -658,7 +664,7 @@ sub end_b { sub start_strong { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { &disable_para(); @@ -670,7 +676,7 @@ sub start_strong { sub end_strong { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { &enable_para(); @@ -683,7 +689,7 @@ sub end_strong { sub start_h1 { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = &end_p(); # Close off any prior para. - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { my $pre; @@ -708,7 +714,7 @@ sub start_h1 { sub end_h1 { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { my $post='\vskip 0 mm '; @@ -732,7 +738,7 @@ sub end_h1 { sub start_h2 { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = &end_p(); # Close off any prior para. - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { my $pre; @@ -754,7 +760,7 @@ sub start_h2 { sub end_h2 { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { my $post='\vskip 0 mm '; @@ -775,7 +781,7 @@ sub end_h2 { sub start_h3 { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = &end_p(); # Close off any prior para. - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { my $pre; @@ -797,7 +803,7 @@ sub start_h3 { sub end_h3 { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { my $post='\vskip 0 mm '; @@ -818,7 +824,7 @@ sub end_h3 { sub start_h4 { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = &end_p(); # Close off any prior para. - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { my $pre; @@ -840,7 +846,7 @@ sub start_h4 { sub end_h4 { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { my $post='\vskip 0 mm '; @@ -861,7 +867,7 @@ sub end_h4 { sub start_h5 { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = &end_p(); # Close off any prior paras. - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { my $pre; @@ -883,7 +889,7 @@ sub start_h5 { sub end_h5 { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { my $post='\vskip 0 mm '; @@ -904,7 +910,7 @@ sub end_h5 { sub start_h6 { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = &end_p(); # Close off any prior paras. - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { my $pre; @@ -926,7 +932,7 @@ sub start_h6 { sub end_h6 { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { my $post='\vskip 0 mm '; @@ -947,7 +953,7 @@ sub end_h6 { sub start_cite { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\textit{'; @@ -958,7 +964,7 @@ sub start_cite { sub end_cite { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}'; @@ -970,7 +976,7 @@ sub end_cite { sub start_i { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\textit{'; @@ -981,7 +987,7 @@ sub start_i { sub end_i { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}'; @@ -993,7 +999,7 @@ sub end_i { sub start_address { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\textit{'; @@ -1004,7 +1010,7 @@ sub start_address { sub end_address { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}'; @@ -1016,7 +1022,7 @@ sub end_address { sub start_dfn { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\textit{'; @@ -1027,7 +1033,7 @@ sub start_dfn { sub end_dfn { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}'; @@ -1039,7 +1045,7 @@ sub end_dfn { sub start_tt { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\texttt{'; @@ -1050,7 +1056,7 @@ sub start_tt { sub end_tt { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}'; @@ -1062,7 +1068,7 @@ sub end_tt { sub start_kbd { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\texttt{'; @@ -1073,7 +1079,7 @@ sub start_kbd { sub end_kbd { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}'; @@ -1085,7 +1091,7 @@ sub end_kbd { sub start_code { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\texttt{'; @@ -1096,7 +1102,7 @@ sub start_code { sub end_code { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}'; @@ -1108,7 +1114,7 @@ sub end_code { sub start_em { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\emph{'; @@ -1119,7 +1125,7 @@ sub start_em { sub end_em { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}'; @@ -1131,7 +1137,7 @@ sub end_em { sub start_q { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\emph{'; @@ -1142,7 +1148,7 @@ sub start_q { sub end_q { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}'; @@ -1181,13 +1187,14 @@ sub enable_para { sub start_p { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= &end_p(); # close off prior para if in progress. $currentstring .= $token->[4]; if (! ($currentstring =~ /\//)) { $closing_string = '

'; # Deal correctly with

e.g. } } elsif ($target eq 'tex' && !$para_disabled) { + $currentstring .= &end_p(); # close off prior para if in progress. my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); if ($align eq 'center') { @@ -1195,7 +1202,6 @@ sub start_p { $closing_string = '\end{center}'; if (&is_inside_of($tagstack, "table")) { $currentstring = ¢er_correction().$currentstring; - #$closing_string .= ¢er_correction(); } } elsif ($align eq 'right') { $currentstring.='\makebox['.$env{'form.textwidth'}.']{\hfill\llap{'; @@ -1205,7 +1211,11 @@ sub start_p { $closing_string = '}\hfill}'; } else { $currentstring.='\par '; - $closing_string = '\strut\\\\\strut '; + if (&is_inside_of($tagstack, 'table')) { + $closing_string = '\vskip 0pt'; # Seems to be consistent with

in tables. + } else { + $closing_string = '\strut\\\\\strut '; + } } } @@ -1232,7 +1242,7 @@ sub end_p { sub start_br { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { my @tempo=@$tagstack; @@ -1260,7 +1270,7 @@ sub start_br { sub end_br { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } return $currentstring; @@ -1270,7 +1280,7 @@ sub end_br { sub start_big { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '{\large '; @@ -1281,7 +1291,7 @@ sub start_big { sub end_big { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}'; @@ -1293,7 +1303,7 @@ sub end_big { sub start_small { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '{\footnotesize '; @@ -1304,7 +1314,7 @@ sub start_small { sub end_small { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}'; @@ -1316,7 +1326,7 @@ sub end_small { sub start_basefont { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { my $basesize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval); @@ -1330,7 +1340,7 @@ sub start_basefont { sub end_basefont { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { my $basesize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval); @@ -1345,7 +1355,7 @@ sub end_basefont { sub start_font { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { my $face=&Apache::lonxml::get_param('face',$parstack,$safeeval); if ($face!~/symbol/i) { if (($env{'browser.fontenhance'} eq 'on') || @@ -1364,7 +1374,7 @@ sub start_font { sub end_font { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { my $fontsize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval); @@ -1379,7 +1389,7 @@ sub end_font { sub start_strike { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { &Apache::lonxml::startredirection(); @@ -1390,7 +1400,7 @@ sub start_strike { sub end_strike { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring=&Apache::lonxml::endredirection(); @@ -1405,7 +1415,7 @@ sub end_strike { sub start_s { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { &Apache::lonxml::startredirection(); @@ -1416,7 +1426,7 @@ sub start_s { sub end_s { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring=&Apache::lonxml::endredirection(); @@ -1431,7 +1441,7 @@ sub end_s { sub start_sub { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\ensuremath{_{'; @@ -1442,7 +1452,7 @@ sub start_sub { sub end_sub { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}}'; @@ -1454,7 +1464,7 @@ sub end_sub { sub start_sup { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\ensuremath{^{'; @@ -1465,7 +1475,7 @@ sub start_sup { sub end_sup { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}}'; @@ -1477,7 +1487,7 @@ sub end_sup { sub start_hr { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = &end_p(); # End enclosing para. - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { my $LaTeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0); @@ -1507,7 +1517,7 @@ sub start_hr { sub end_hr { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } return $currentstring; @@ -1525,7 +1535,7 @@ sub end_hr { sub start_div { my ($target,$token, $tagstack, $parstack, $parser, $safeeval) = @_; my $currentstring = &end_p(); # Close enclosing para. - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } if ($target eq 'tex') { @@ -1540,7 +1550,6 @@ sub start_div { $endstring = '\end{center}'; if (&is_inside_of($tagstack, "table")) { $currentstring = ¢er_correction().$currentstring; - #$endstring .= ¢er_correction(); } } elsif ($align eq 'right') { @@ -1562,7 +1571,7 @@ sub start_div { sub end_div { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } if ($target eq 'tex') { @@ -1577,7 +1586,7 @@ sub end_div { sub start_a { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { my $href=&Apache::lonxml::get_param('href',$parstack,$safeeval, undef,1); $currentstring=&Apache::lonenc::encrypt_ref($token,{'href'=>$href}); @@ -1599,7 +1608,7 @@ sub start_a { sub end_a { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } return $currentstring; @@ -1609,7 +1618,7 @@ sub end_a { sub start_li { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0); @@ -1640,7 +1649,7 @@ sub start_li { sub end_li { my ($target,$token) = @_; my $currentstring = &end_p(); # In case there's a

in the

  • - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } return $currentstring; @@ -1650,7 +1659,7 @@ sub end_li { sub start_u { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { &Apache::lonxml::startredirection(); @@ -1661,7 +1670,7 @@ sub start_u { sub end_u { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring=&Apache::lonxml::endredirection(); @@ -1676,7 +1685,7 @@ sub end_u { sub start_ul { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = &end_p(); # Close off enclosing list. - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { my $TeXtype=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0); @@ -1705,7 +1714,7 @@ sub start_ul { sub end_ul { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $currentstring = '\end{itemize} \renewcommand{\labelitemi}{$\bullet$}'. @@ -1720,7 +1729,7 @@ sub end_ul { sub start_menu { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { $currentstring = " \\begin{itemize} "; @@ -1731,7 +1740,7 @@ sub start_menu { sub end_menu { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $currentstring = " \\end{itemize}"; @@ -1743,7 +1752,7 @@ sub end_menu { sub start_dir { my ($target,$token) = @_; my $currentstring = &end_p(); # In case there's a

    prior to the list. - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= " \\begin{itemize} "; @@ -1754,7 +1763,7 @@ sub start_dir { sub end_dir { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $currentstring = " \\end{itemize}"; @@ -1766,7 +1775,7 @@ sub end_dir { sub start_ol { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = &end_p(); # In case there's a

    prior to the list. - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $Apache::londefdef::list_index=0; @@ -1805,7 +1814,7 @@ sub start_ol { sub end_ol { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $currentstring = '\end{enumerate}\renewcommand{\labelenumi}{\arabic{enumi}.}'. @@ -1820,7 +1829,7 @@ sub end_ol { sub start_dl { my ($target,$token) = @_; my $currentstring = &end_p(); # In case there's a

    unclosed prior to the list. - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\begin{description}'; @@ -1836,7 +1845,7 @@ sub start_dl { sub end_dl { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { if ($Apache::londefdef::DT[-1]) { &end_dt(@_); } @@ -1858,7 +1867,7 @@ sub end_dl { sub start_dt { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring=''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { if ($Apache::londefdef::DT[-1]) { &end_dt(@_); } @@ -1873,7 +1882,7 @@ sub start_dt { sub end_dt { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { if ($Apache::londefdef::DT[-1]) { @@ -1896,7 +1905,7 @@ sub item_cleanup { sub start_dd { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { if ($Apache::londefdef::DT[-1]) { &end_dt(@_); } @@ -1915,7 +1924,7 @@ sub start_dd { sub end_dd { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $Apache::londefdef::description[-1]->[-1].= @@ -1936,7 +1945,7 @@ sub start_table { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $textwidth = ''; my $currentstring = &end_p(); - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { my $aa = {}; @@ -1981,7 +1990,12 @@ sub start_table { $Apache::londefdef::table[-1]{'width'}=$1*$textwidth/100; } else { $Apache::londefdef::table[-1]{'width'}=$TeXwidth; - } + } + # In the end, however the table width cannot be wider than $textwidth... + + if ($Apache::londefdef::table[-1]{'width'} > $textwidth) { + $Apache::londefdef::table[-1]{'width'} = $textwidth; + } #table's border my $border = &Apache::lonxml::get_param('border',$parstack,$safeeval); @@ -2019,7 +2033,7 @@ sub start_table { sub end_table { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { my $inmemory = ''; @@ -2209,7 +2223,38 @@ sub end_table { $header_of_table .= '}'; #fill the table for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) { + my $have_rowspan = 0; for (my $jn=0;$jn<=$#fwidth;$jn++) { + + #----------------------------------------------------------- + # I think this order of doing things will ensure that + # single rowspan, columspan and combined row/colspans will + # work correctly. LaTeX is delicate here. + # RF. + + # Start a rowspan if necessary: + + my $rowspan = $Apache::londefdef::table[-1]{'rowspan'}[$in][$jn]; + my $colspan = $Apache::londefdef::table[-1]{'colspan'}[$in][$jn]; + # + # Do the appropriate magic if this has a colspan + # + + if ($colspan > 1) { + $output .= '\multicolumn{'. + $colspan + .'}{|l|}{'; + } + + if ($rowspan > 1) { + $have_rowspan++; + $output .= '\multirow{'.$rowspan.'}[0]{'.$fwidth[$jn].'mm}{'; + } + if (($rowspan eq '^') || ($rowspan eq '_')) { + $have_rowspan++; + } + #-------------------------------------------------------------- + if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { $output.=¢er_correction().'\begin{center}'; } elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { @@ -2217,13 +2262,43 @@ sub end_table { } $output.=$Apache::londefdef::table[-1]{'content'}[$in][$jn]; if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') { - $output.='\end{center}';#.¢er_correction(); + $output.='\end{center}'; } elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') { $output.='} '; } + # Close off any open multirow: + + if ($rowspan > 1) { + $output .= '}'; + } + # Close off the colspan... + # + if ($colspan > 1) { + $output .= '}'; + $jn += $colspan-1; # Adjust for number of rows really left. + } if ($jn!=$#fwidth) {$output.=' '.$Apache::londefdef::table[-1]{'vinc'};} } - $output.=' \\\\ '.$Apache::londefdef::table[-1]{'hinc'}.' '; + # If have_rowspan > 0, and borders are on, then + # we need to do more than put an \hline at the bottom of row. + # we need to do the appropriate \cline to ensure that + # the spanned rows don't have \hlines through them. + + if (($Apache::londefdef::table[-1]{'hinc'} =~ /\\hline/) && $have_rowspan) { + $output .= ' \\\\ '; + for (my $jn=0; $jn<=$#fwidth;$jn++) { + my $rowspan = $Apache::londefdef::table[-1]{'rowspan'}[$in][$jn]; + if ($rowspan ne "^") { + if (($rowspan <= 1) || ($rowspan eq '_')) { + my $column = $jn+1; + $output .= '\cline{'.$column.'-'.$column.'} '; + } + } + } + + } else { + $output.=' \\\\ '.$Apache::londefdef::table[-1]{'hinc'}.' '; + } } # Note that \newline destroys alignment env's produced by e.g.

    # $Apache::londefdef::table[-1]{'output'} .= $header_of_table.$Apache::londefdef::table[-1]{'hinc'}.$output.'\end{tabular}\strut\newline\strut '; @@ -2271,7 +2346,7 @@ sub end_table { sub start_tr { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { $Apache::londefdef::table[-1]{'row_number'}++; @@ -2299,7 +2374,7 @@ sub start_tr { sub end_tr { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = &end_p(); # Close any pending

    in the row. - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { if ($Apache::londefdef::TD_redirection) { @@ -2321,7 +2396,7 @@ sub end_tr { sub start_td { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { $Apache::londefdef::TD_redirection = 1; @@ -2367,8 +2442,51 @@ sub start_td_tex { sub end_td_tex { my ($parstack,$parser,$safeeval) = @_; - my $current_row = $Apache::londefdef::table[-1]{'row_number'}; - my $data=&Apache::lonxml::endredirection(); + my $current_row = $Apache::londefdef::table[-1]{'row_number'}; + my $current_column = $Apache::londefdef::table[-1]{'counter_columns'}; + my $data = &Apache::lonxml::endredirection(); + + # The rowspan array of the table indicates which cells are part of a span. + # n indicates the start of a span set of n rows. + # ^ indicates a cell that continues a span set. + # _ indicates the cell is at the bottom of a span set. + # If this and subsequent cells are part of a rowspan, we must + # push along the row until we find one that is not. + + while ((defined $Apache::londefdef::table[-1]{'rowspan'}[$current_row] [$current_column]) + && ($Apache::londefdef::table[-1]{'rowspan'}[$current_row][$current_column] =~ /[\^\_]/)) { + # Part of a span. + push @ {$Apache::londefdef::table[-1]{'content'}[-1]}, ''; + $current_column++; + } + $Apache::londefdef::table[-1]{'counter_columns'} = $current_column; + + + # Get the column and row spans. + # Colspan can be done via \multicolumn if I can figure out the data structs. + + my $colspan = &Apache::lonxml::get_param('colspan', $parstack, $safeeval, undef, 0); + if (!$colspan) { + $colspan = 1; + } + + my $rowspan = &Apache::lonxml::get_param('rowspan', $parstack, $safeeval, undef, 0); + if (!$rowspan) { + $rowspan = 1; + } + + + + for (my $c = 0; $c < $colspan; $c++) { + $Apache::londefdef::table[-1]{'rowspan'}[$current_row][$current_column+$c] = $rowspan; + for (my $i = 1; $i < $rowspan; $i++) { + $Apache::londefdef::table[-1]{'rowspan'}[$current_row+$i][$current_column+$c] = '^'; + if ($i == ($rowspan-1)) { + $Apache::londefdef::table[-1]{'rowspan'}[$current_row+$i][$current_column+$c] = '_'; + } + } + } + my $TeXwidth=&Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0); if (defined $TeXwidth) { push @ {$Apache::londefdef::table[-1]{'objectlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0'; @@ -2457,14 +2575,37 @@ sub end_td_tex { } # Should be be killing off the 'include' elements as they're used up? + push @ {$Apache::londefdef::table[-1]{'content'}[-1] },$data; + + + + + # the colspan array will indicate how many columns will be spanned by this + # cell..this requires that counter_columns also be adjusted accordingly + # so that the next bunch of text goes in the right cell. Note that since + # counter_columns is incremented in the start_td_tex, we adjust by colspan-1. + # + + $Apache::londefdef::table[-1]{'counter_columns'} += $colspan -1; + for (my $i = 0; $i < ($colspan -1); $i++) { + push @ {$Apache::londefdef::table[-1]{'content'}[-1] },''; + } + for (my $r = 0; $r < $rowspan; $r++) { + $Apache::londefdef::table[-1]{'colspan'}[$current_row+$r][$current_column] = $colspan; + # Put empty text in spanned cols. + + } + + + return ''; } sub end_td { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $Apache::londefdef::TD_redirection =0; @@ -2477,7 +2618,7 @@ sub end_td { sub start_th { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { $Apache::londefdef::TD_redirection = 1; @@ -2593,7 +2734,7 @@ sub end_th_tex { sub end_th { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = &end_p(); # Close any open

    in the row. - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $Apache::londefdef::TD_redirection =0; @@ -2617,9 +2758,7 @@ sub start_img { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_; my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval, undef,1); - if (! $src && - ($target eq 'web' || $target eq 'webgrade' || $target eq 'tex') - ) { + if (not $src and ($target eq 'web' or $target eq 'tex')) { my $inside = &Apache::lonxml::get_all_text("/img",$parser,$style); return ''; } @@ -2629,15 +2768,19 @@ sub start_img { # Render unto browsers that which are the browser's... - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { if ($env{'browser.imagesuppress'} ne 'on') { - $currentstring.=&Apache::lonenc::encrypt_ref($token,{'src'=>$src}); - } else { - my $alttag= &Apache::lonxml::get_param - ('alt',$parstack,$safeeval,undef,1); - unless ($alttag) { - $alttag=&Apache::lonmeta::alttag - ($Apache::lonxml::pwd[-1],$src); + my $enc = ('yes' eq + lc(&Apache::lonxml::get_param('encrypturl',$parstack, + $safeeval))); + $currentstring.=&Apache::lonenc::encrypt_ref($token,{'src'=>$src}, + $enc); + } else { + my $alttag = &Apache::lonxml::get_param('alt',$parstack,$safeeval, + undef,1); + if (!$alttag) { + $alttag = &Apache::lonmeta::alttag($Apache::lonxml::pwd[-1], + $src); } $currentstring.='[IMAGE: '.$alttag.']'; } @@ -2656,12 +2799,7 @@ sub start_img { $safeeval, undef,1)); if(!$align) { - # disabled for now see BUG#4535 - if (&is_inside_of($tagstack, "table")) { - $align = "top"; # Force top of image to top of table cell - } else { $align = "bottom"; # This is html's default so it's ours too. - } } # &Apache::lonxml::debug("Alignemnt = $align"); @@ -2676,11 +2814,17 @@ sub start_img { $parstack, $safeeval, undef,0); - &Apache::lonxml::debug("LaTeX rendering = $latex_rendering"); + # &Apache::lonxml::debug("LaTeX rendering = $latex_rendering"); if(!$latex_rendering) { - $latex_rendering = "texwrap"; + $latex_rendering = "texwrap"; + } + # using texwrap inside a table does not work. So, if after all of this, + # texwrap is on, we turn it off if we detect we're in a table: + # + if (($latex_rendering eq 'texwrap') && &is_inside_of($tagstack, "table")) { + $latex_rendering = 'parpic'; } - &Apache::lonxml::debug("LaTeX rendering = $latex_rendering image file: $src"); + # &Apache::lonxml::debug("LaTeX rendering = $latex_rendering image file: $src"); #if original gif/jpg/png file exist do following: my $origsrc=$src; @@ -2762,6 +2906,8 @@ sub start_img { ['','bottom','middle','top','left','right'],$token,5); $currentstring .=&Apache::edit::select_arg('TeXwrap:', 'TeXwrap', ['', 'parbox', 'parpic'], $token, 2); + $currentstring .=&Apache::edit::select_arg('Encyrpt URL:','encrypturl', + ['no','yes'], $token, 2); $currentstring .=&Apache::edit::end_row().&Apache::edit::start_spanning_row(); my $src= &Apache::lonxml::get_param('src',$parstack,$safeeval); my $alt= &Apache::lonxml::get_param('alt',$parstack,$safeeval); @@ -2779,7 +2925,7 @@ sub start_img { my $ctag=&Apache::edit::get_new_args($token,$parstack, $safeeval,'src','alt','align', 'TeXwidth','TeXheight', 'TeXwrap', - 'width','height'); + 'width','height','encrypturl'); my ($nsrc,$nwidth,$nheight)= ($token->[2]{'src'},$token->[2]{'width'},$token->[2]{'height'}); my $loc=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$nsrc); @@ -2821,7 +2967,7 @@ sub start_img { sub end_img { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $currentstring = ''; @@ -2839,7 +2985,7 @@ sub start_applet { undef,1); &Apache::lonxml::extlink($archive); my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { if ($env{'browser.appletsuppress'} ne 'on') { $currentstring = &Apache::lonenc::encrypt_ref($token, {'code'=>$code, @@ -2872,7 +3018,7 @@ sub start_applet { sub end_applet { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { } @@ -2885,7 +3031,7 @@ sub start_embed { my $src=&Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1); &Apache::lonxml::extlink($src); my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { if ($env{'browser.embedsuppress'} ne 'on') { $currentstring=&Apache::lonenc::encrypt_ref($token,{'src'=>$src}); } else { @@ -2904,7 +3050,7 @@ sub start_embed { sub end_embed { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { } @@ -2924,7 +3070,7 @@ sub start_param { my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1); &Apache::lonxml::extlink($src); my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { my %toconvert; my $src=&Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1); if ($src) { $toconvert{'src'}= $src; } @@ -2943,7 +3089,7 @@ sub start_param { sub end_param { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { } @@ -2981,7 +3127,7 @@ sub end_allow { sub start_frameset { my ($target,$token) = @_; my $currentstring = ''; # Close any pending para. - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { if (!$Apache::lonxml::registered && $env{'request.state'} eq 'published') { $currentstring.=''. @@ -3017,7 +3163,7 @@ sub start_frameset { sub end_frameset { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3027,7 +3173,7 @@ sub end_frameset { sub start_xmp { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\begin{verbatim}'; @@ -3038,7 +3184,7 @@ sub start_xmp { sub end_xmp { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '\end{verbatim}'; @@ -3050,10 +3196,11 @@ sub end_xmp { sub start_pre { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = &end_p(); # close off pending

    - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\begin{verbatim}'; + &Apache::lonxml::disable_LaTeX_substitutions(); } return $currentstring; } @@ -3061,10 +3208,11 @@ sub start_pre { sub end_pre { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '\end{verbatim}'; + &Apache::lonxml::enable_LaTeX_substitutions(); } return $currentstring; } @@ -3073,7 +3221,7 @@ sub end_pre { sub start_insert { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { my $display = &Apache::lonxml::get_param('display',$parstack,$safeeval,undef,1); $currentstring .= ''.$display.'';; } @@ -3083,7 +3231,7 @@ sub start_insert { sub end_insert { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= ''; } return $currentstring; @@ -3093,7 +3241,7 @@ sub end_insert { sub start_externallink { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { my $display = &Apache::lonxml::get_param('display',$parstack,$safeeval,undef,1); $currentstring .= ''.$display.'';; } @@ -3103,7 +3251,7 @@ sub start_externallink { sub end_externallink { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= ''; } return $currentstring; @@ -3133,7 +3281,7 @@ sub end_blankspace { sub start_abbr { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3142,7 +3290,7 @@ sub start_abbr { sub end_abbr { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3152,7 +3300,7 @@ sub end_abbr { sub start_acronym { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3161,7 +3309,7 @@ sub start_acronym { sub end_acronym { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3171,7 +3319,7 @@ sub end_acronym { sub start_area { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3180,7 +3328,7 @@ sub start_area { sub end_area { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3190,7 +3338,7 @@ sub end_area { sub start_base { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3199,7 +3347,7 @@ sub start_base { sub end_base { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3209,7 +3357,7 @@ sub end_base { sub start_bdo { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3218,7 +3366,7 @@ sub start_bdo { sub end_bdo { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3228,7 +3376,7 @@ sub end_bdo { sub start_bgsound { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3237,7 +3385,7 @@ sub start_bgsound { sub end_bgsound { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3247,7 +3395,7 @@ sub end_bgsound { sub start_blink { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3256,7 +3404,7 @@ sub start_blink { sub end_blink { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3266,7 +3414,7 @@ sub end_blink { sub start_blockquote { my ($target,$token) = @_; my $currentstring = &end_p(); # Close any unclosed

    - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } return $currentstring; @@ -3275,7 +3423,7 @@ sub start_blockquote { sub end_blockquote { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3285,7 +3433,7 @@ sub end_blockquote { sub start_button { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3294,7 +3442,7 @@ sub start_button { sub end_button { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3304,7 +3452,7 @@ sub end_button { sub start_caption { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3313,7 +3461,7 @@ sub start_caption { sub end_caption { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3323,7 +3471,7 @@ sub end_caption { sub start_col { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3332,7 +3480,7 @@ sub start_col { sub end_col { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3342,7 +3490,7 @@ sub end_col { sub start_colgroup { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3351,7 +3499,7 @@ sub start_colgroup { sub end_colgroup { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3361,7 +3509,7 @@ sub end_colgroup { sub start_del { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3370,7 +3518,7 @@ sub start_del { sub end_del { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3380,7 +3528,7 @@ sub end_del { sub start_fieldset { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3389,7 +3537,7 @@ sub start_fieldset { sub end_fieldset { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3399,7 +3547,7 @@ sub end_fieldset { sub start_frame { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3408,7 +3556,7 @@ sub start_frame { sub end_frame { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3418,7 +3566,7 @@ sub end_frame { sub start_iframe { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3427,7 +3575,7 @@ sub start_iframe { sub end_iframe { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3437,7 +3585,7 @@ sub end_iframe { sub start_ins { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3446,7 +3594,7 @@ sub start_ins { sub end_ins { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3456,7 +3604,7 @@ sub end_ins { sub start_isindex { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3465,7 +3613,7 @@ sub start_isindex { sub end_isindex { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3475,7 +3623,7 @@ sub end_isindex { sub start_keygen { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3484,7 +3632,7 @@ sub start_keygen { sub end_keygen { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3494,7 +3642,7 @@ sub end_keygen { sub start_label { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3503,7 +3651,7 @@ sub start_label { sub end_label { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3513,7 +3661,7 @@ sub end_label { sub start_layer { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3522,7 +3670,7 @@ sub start_layer { sub end_layer { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3532,7 +3680,7 @@ sub end_layer { sub start_legend { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3541,7 +3689,7 @@ sub start_legend { sub end_legend { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3551,7 +3699,7 @@ sub end_legend { sub start_link { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { my $href=&Apache::lonxml::get_param('href',$parstack,$safeeval, undef,1); &Apache::lonxml::extlink($href); @@ -3563,7 +3711,7 @@ sub start_link { sub end_link { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3573,7 +3721,7 @@ sub end_link { sub start_marquee { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3582,7 +3730,7 @@ sub start_marquee { sub end_marquee { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3592,7 +3740,7 @@ sub end_marquee { sub start_multicol { my ($target,$token) = @_; my $currentstring = &end_p(); # Close any pending

    - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } return $currentstring; @@ -3601,7 +3749,7 @@ sub start_multicol { sub end_multicol { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3611,7 +3759,7 @@ sub end_multicol { sub start_nobr { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { $currentstring='\mbox{'; @@ -3622,7 +3770,7 @@ sub start_nobr { sub end_nobr { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $currentstring='}'; @@ -3634,7 +3782,7 @@ sub end_nobr { sub start_noembed { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3643,7 +3791,7 @@ sub start_noembed { sub end_noembed { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3653,7 +3801,7 @@ sub end_noembed { sub start_noframes { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3662,7 +3810,7 @@ sub start_noframes { sub end_noframes { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3672,7 +3820,7 @@ sub end_noframes { sub start_nolayer { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3681,7 +3829,7 @@ sub start_nolayer { sub end_nolayer { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3691,7 +3839,7 @@ sub end_nolayer { sub start_noscript { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3700,7 +3848,7 @@ sub start_noscript { sub end_noscript { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3710,7 +3858,7 @@ sub end_noscript { sub start_object { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3719,7 +3867,7 @@ sub start_object { sub end_object { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3729,7 +3877,7 @@ sub end_object { sub start_optgroup { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3738,7 +3886,7 @@ sub start_optgroup { sub end_optgroup { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3748,7 +3896,7 @@ sub end_optgroup { sub start_samp { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { $currentstring='\texttt{'; @@ -3759,7 +3907,7 @@ sub start_samp { sub end_samp { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $currentstring='}'; @@ -3771,7 +3919,7 @@ sub end_samp { sub start_server { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3780,7 +3928,7 @@ sub start_server { sub end_server { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3790,7 +3938,7 @@ sub end_server { sub start_spacer { my ($target,$token) = @_; my $currentstring = &end_p(); # Close off any open

    tag. - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring .= $token->[4]; } return $currentstring; @@ -3799,7 +3947,7 @@ sub start_spacer { sub end_spacer { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3809,7 +3957,7 @@ sub end_spacer { sub start_span { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3818,7 +3966,7 @@ sub start_span { sub end_span { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3828,7 +3976,7 @@ sub end_span { sub start_tbody { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3837,7 +3985,7 @@ sub start_tbody { sub end_tbody { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3847,7 +3995,7 @@ sub end_tbody { sub start_tfoot { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3856,7 +4004,7 @@ sub start_tfoot { sub end_tfoot { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3866,7 +4014,7 @@ sub end_tfoot { sub start_thead { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3875,7 +4023,7 @@ sub start_thead { sub end_thead { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3885,7 +4033,7 @@ sub end_thead { sub start_var { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { $currentstring = '\textit{'; @@ -3896,7 +4044,7 @@ sub start_var { sub end_var { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $currentstring = '}'; @@ -3908,7 +4056,7 @@ sub end_var { sub start_wbr { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[4]; } return $currentstring; @@ -3917,7 +4065,7 @@ sub start_wbr { sub end_wbr { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = $token->[2]; } return $currentstring; @@ -3926,7 +4074,7 @@ sub end_wbr { #-- tag sub start_hideweboutput { my ($target,$token) = @_; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { &Apache::lonxml::startredirection(); } return ''; @@ -3935,7 +4083,7 @@ sub start_hideweboutput { sub end_hideweboutput { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' || $target eq 'webgrade') { + if ($target eq 'web') { $currentstring = &Apache::lonxml::endredirection(); } return '';