Diff for /loncom/xml/londefdef.pm between versions 1.302 and 1.302.2.5

version 1.302, 2005/12/06 22:55:31 version 1.302.2.5, 2006/03/29 23:00:51
Line 146  sub end_m { Line 146  sub end_m {
 sub start_tthoption {  sub start_tthoption {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_;
     my $result;      my $result;
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  my $inside = &Apache::lonxml::get_all_text("/tthoption",$parser,   my $inside = &Apache::lonxml::get_all_text("/tthoption",$parser,
    $style);     $style);
  $inside=~s/^\s*//;   $inside=~s/^\s*//;
Line 201  sub start_html { Line 201  sub start_html {
 sub end_html {  sub end_html {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = '</html>';   $currentstring = '</html>';
     }      }
     return $currentstring;      return $currentstring;
Line 211  sub end_html { Line 211  sub end_html {
 sub start_head {  sub start_head {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4].&Apache::lonxml::fontsettings();   $currentstring = $token->[4].&Apache::lonxml::fontsettings();
     }       } 
     return $currentstring;      return $currentstring;
Line 220  sub start_head { Line 220  sub start_head {
 sub end_head {  sub end_head {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web' && $env{'request.state'} eq 'published') {      if (($target eq 'web'      && $env{'request.state'} eq 'published') ||
    ($target eq 'webgrade' && $env{'request.state'} eq 'published')) {
  $currentstring = &Apache::lonmenu::registerurl(undef,$target).   $currentstring = &Apache::lonmenu::registerurl(undef,$target).
     $token->[2];          $token->[2];    
     }       } 
Line 231  sub end_head { Line 232  sub end_head {
 sub start_map {  sub start_map {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 240  sub start_map { Line 241  sub start_map {
 sub end_map {  sub end_map {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 250  sub end_map { Line 251  sub end_map {
 sub start_select {  sub start_select {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }  elsif ($target eq 'tex') {      }  elsif ($target eq 'tex') {
  $Apache::londefdef::select=0;   $Apache::londefdef::select=0;
Line 261  sub start_select { Line 262  sub start_select {
 sub end_select {  sub end_select {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 271  sub end_select { Line 272  sub end_select {
 sub start_option {  sub start_option {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $Apache::londefdef::select++;   $Apache::londefdef::select++;
Line 287  sub start_option { Line 288  sub start_option {
 sub end_option {  sub end_option {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }  elsif ($target eq 'tex') {      }  elsif ($target eq 'tex') {
  $currentstring='}';   $currentstring='}';
Line 299  sub end_option { Line 300  sub end_option {
 sub start_input {  sub start_input {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 308  sub start_input { Line 309  sub start_input {
 sub end_input {  sub end_input {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 318  sub end_input { Line 319  sub end_input {
 sub start_textarea {  sub start_textarea {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 327  sub start_textarea { Line 328  sub start_textarea {
 sub end_textarea {  sub end_textarea {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 337  sub end_textarea { Line 338  sub end_textarea {
 sub start_form {  sub start_form {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 346  sub start_form { Line 347  sub start_form {
 sub end_form {  sub end_form {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 356  sub end_form { Line 357  sub end_form {
 sub start_title {  sub start_title {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\keephidden{Title of the document:  '    $currentstring .= '\keephidden{Title of the document:  ' 
Line 371  sub start_title { Line 372  sub start_title {
 sub end_title {  sub end_title {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
Line 387  sub end_title { Line 388  sub end_title {
 sub start_meta {  sub start_meta {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  my $args='';   my $args='';
  if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }   if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
  if ($args eq '') {   if ($args eq '') {
Line 436  sub start_meta { Line 437  sub start_meta {
 sub end_meta {  sub end_meta {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  my $args='';   my $args='';
  if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }   if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
  if ($args ne '') {   if ($args ne '') {
Line 502  sub start_body { Line 503  sub start_body {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
   
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  if ($Apache::lonhomework::parsing_a_problem) {   if ($Apache::lonhomework::parsing_a_problem) {
     &Apache::lonxml::warning("<body> tag found inside of <problem> tag this can cause problems.");      &Apache::lonxml::warning("<body> tag found inside of <problem> tag this can cause problems.");
     return '';      return '';
Line 586  EDITBUTTON Line 587  EDITBUTTON
 sub end_body {  sub end_body {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = &end_p(); # Close off unclosed <p>      my $currentstring = &end_p(); # Close off unclosed <p>
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= &Apache::lonxml::xmlend($target,$parser);   $currentstring .= &Apache::lonxml::xmlend($target,$parser);
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\strut\newline\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\newline\noindent \end{document}';     $currentstring .= '\strut\newline\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\newline\noindent \end{document}';  
Line 594  sub end_body { Line 595  sub end_body {
     return $currentstring;      return $currentstring;
 }  }
   
   # \begin{center} causes a new paragprah spacing that looks odd inside 
   # of a table cell
   sub center_correction { return '\vspace*{-6 mm}'; }
 #-- <center> tag (end tag required)  #-- <center> tag (end tag required)
 sub start_center {  sub start_center {
     my ($target,$token) = @_;      my ($target,$token,$tagstack) = @_;
     my $currentstring = &end_p(); # Close off any prior para.      my $currentstring = &end_p(); # Close off any prior para.
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];        $currentstring .= $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
    if (&is_inside_of($tagstack, "table")) {
       $currentstring .= &center_correction();
    }
  $currentstring .= '\begin{center}';     $currentstring .= '\begin{center}';  
     }      }
     return $currentstring;      return $currentstring;
 }  }
   
 sub end_center {  sub end_center {
     my ($target,$token) = @_;      my ($target,$token,$tagstack) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = '\end{center}';     $currentstring = '\end{center}';  
    if (&is_inside_of($tagstack, "table")) {
       #$currentstring .= &center_correction();
    }
     }      }
     return $currentstring;      return $currentstring;
 }  }
Line 622  sub end_center { Line 632  sub end_center {
 sub start_b {  sub start_b {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  &disable_para();   &disable_para();
Line 634  sub start_b { Line 644  sub start_b {
 sub end_b {  sub end_b {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  &enable_para();   &enable_para();
Line 648  sub end_b { Line 658  sub end_b {
 sub start_strong {  sub start_strong {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  &disable_para();   &disable_para();
Line 660  sub start_strong { Line 670  sub start_strong {
 sub end_strong {  sub end_strong {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  &enable_para();   &enable_para();
Line 673  sub end_strong { Line 683  sub end_strong {
 sub start_h1 {  sub start_h1 {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = &end_p(); # Close off any prior para.      my $currentstring = &end_p(); # Close off any prior para.
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $pre;   my $pre;
Line 698  sub start_h1 { Line 708  sub start_h1 {
 sub end_h1 {  sub end_h1 {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $post='\vskip 0 mm ';   my $post='\vskip 0 mm ';
Line 722  sub end_h1 { Line 732  sub end_h1 {
 sub start_h2 {  sub start_h2 {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = &end_p(); # Close off any prior para.      my $currentstring = &end_p(); # Close off any prior para.
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $pre;   my $pre;
Line 744  sub start_h2 { Line 754  sub start_h2 {
 sub end_h2 {  sub end_h2 {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $post='\vskip 0 mm ';   my $post='\vskip 0 mm ';
Line 765  sub end_h2 { Line 775  sub end_h2 {
 sub start_h3 {  sub start_h3 {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = &end_p(); # Close off any prior para.      my $currentstring = &end_p(); # Close off any prior para.
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $pre;   my $pre;
Line 787  sub start_h3 { Line 797  sub start_h3 {
 sub end_h3 {  sub end_h3 {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $post='\vskip 0 mm ';   my $post='\vskip 0 mm ';
Line 808  sub end_h3 { Line 818  sub end_h3 {
 sub start_h4 {  sub start_h4 {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = &end_p(); # Close off any prior para.      my $currentstring = &end_p(); # Close off any prior para.
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $pre;   my $pre;
Line 830  sub start_h4 { Line 840  sub start_h4 {
 sub end_h4 {  sub end_h4 {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $post='\vskip 0 mm ';   my $post='\vskip 0 mm ';
Line 851  sub end_h4 { Line 861  sub end_h4 {
 sub start_h5 {  sub start_h5 {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = &end_p(); # Close off any prior paras.      my $currentstring = &end_p(); # Close off any prior paras.
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $pre;   my $pre;
Line 873  sub start_h5 { Line 883  sub start_h5 {
 sub end_h5 {  sub end_h5 {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $post='\vskip 0 mm ';   my $post='\vskip 0 mm ';
Line 894  sub end_h5 { Line 904  sub end_h5 {
 sub start_h6 {  sub start_h6 {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = &end_p(); # Close off any prior paras.      my $currentstring = &end_p(); # Close off any prior paras.
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $pre;   my $pre;
Line 916  sub start_h6 { Line 926  sub start_h6 {
 sub end_h6 {  sub end_h6 {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $post='\vskip 0 mm ';   my $post='\vskip 0 mm ';
Line 937  sub end_h6 { Line 947  sub end_h6 {
 sub start_cite {  sub start_cite {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\textit{';   $currentstring .= '\textit{';
Line 948  sub start_cite { Line 958  sub start_cite {
 sub end_cite {  sub end_cite {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
Line 960  sub end_cite { Line 970  sub end_cite {
 sub start_i {  sub start_i {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\textit{';   $currentstring .= '\textit{';
Line 971  sub start_i { Line 981  sub start_i {
 sub end_i {  sub end_i {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
Line 983  sub end_i { Line 993  sub end_i {
 sub start_address {  sub start_address {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\textit{';   $currentstring .= '\textit{';
Line 994  sub start_address { Line 1004  sub start_address {
 sub end_address {  sub end_address {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
Line 1006  sub end_address { Line 1016  sub end_address {
 sub start_dfn {  sub start_dfn {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\textit{';   $currentstring .= '\textit{';
Line 1017  sub start_dfn { Line 1027  sub start_dfn {
 sub end_dfn {  sub end_dfn {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
Line 1029  sub end_dfn { Line 1039  sub end_dfn {
 sub start_tt {  sub start_tt {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\texttt{';   $currentstring .= '\texttt{';
Line 1040  sub start_tt { Line 1050  sub start_tt {
 sub end_tt {  sub end_tt {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
Line 1052  sub end_tt { Line 1062  sub end_tt {
 sub start_kbd {  sub start_kbd {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\texttt{';   $currentstring .= '\texttt{';
Line 1063  sub start_kbd { Line 1073  sub start_kbd {
 sub end_kbd {  sub end_kbd {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
Line 1075  sub end_kbd { Line 1085  sub end_kbd {
 sub start_code {  sub start_code {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\texttt{';   $currentstring .= '\texttt{';
Line 1086  sub start_code { Line 1096  sub start_code {
 sub end_code {  sub end_code {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
Line 1098  sub end_code { Line 1108  sub end_code {
 sub start_em {  sub start_em {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\emph{';   $currentstring .= '\emph{';
Line 1109  sub start_em { Line 1119  sub start_em {
 sub end_em {  sub end_em {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
Line 1121  sub end_em { Line 1131  sub end_em {
 sub start_q {  sub start_q {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\emph{';   $currentstring .= '\emph{';
Line 1132  sub start_q { Line 1142  sub start_q {
 sub end_q {  sub end_q {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
Line 1171  sub enable_para { Line 1181  sub enable_para {
 sub start_p {  sub start_p {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= &end_p(); # close off prior para if in progress.   $currentstring .= &end_p(); # close off prior para if in progress.
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
  if (! ($currentstring =~ /\//)) {   if (! ($currentstring =~ /\//)) {
Line 1183  sub start_p { Line 1193  sub start_p {
  if ($align eq 'center') {   if ($align eq 'center') {
     $currentstring .='\begin{center}\par';      $currentstring .='\begin{center}\par';
     $closing_string = '\end{center}';      $closing_string = '\end{center}';
       if (&is_inside_of($tagstack, "table")) {
    $currentstring = &center_correction().$currentstring;
    #$closing_string .= &center_correction();
       }
  } elsif ($align eq 'right') {   } elsif ($align eq 'right') {
     $currentstring.='\makebox['.$env{'form.textwidth'}.']{\hfill\llap{';      $currentstring.='\makebox['.$env{'form.textwidth'}.']{\hfill\llap{';
     $closing_string= '}}';      $closing_string= '}}';
Line 1218  sub end_p { Line 1232  sub end_p {
 sub start_br {  sub start_br {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my @tempo=@$tagstack;   my @tempo=@$tagstack;
Line 1246  sub start_br { Line 1260  sub start_br {
 sub end_br {  sub end_br {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     }      }
     return $currentstring;      return $currentstring;
Line 1256  sub end_br { Line 1270  sub end_br {
 sub start_big {  sub start_big {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '{\large ';   $currentstring .= '{\large ';
Line 1267  sub start_big { Line 1281  sub start_big {
 sub end_big {  sub end_big {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
Line 1279  sub end_big { Line 1293  sub end_big {
 sub start_small {  sub start_small {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '{\footnotesize ';   $currentstring .= '{\footnotesize ';
Line 1290  sub start_small { Line 1304  sub start_small {
 sub end_small {  sub end_small {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}';   $currentstring .= '}';
Line 1302  sub end_small { Line 1316  sub end_small {
 sub start_basefont {  sub start_basefont {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $basesize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval);   my $basesize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval);
Line 1316  sub start_basefont { Line 1330  sub start_basefont {
 sub end_basefont {  sub end_basefont {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $basesize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval);   my $basesize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval);
Line 1331  sub end_basefont { Line 1345  sub end_basefont {
 sub start_font {  sub start_font {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  my $face=&Apache::lonxml::get_param('face',$parstack,$safeeval);   my $face=&Apache::lonxml::get_param('face',$parstack,$safeeval);
  if ($face!~/symbol/i) {   if ($face!~/symbol/i) {
     if (($env{'browser.fontenhance'} eq 'on') ||       if (($env{'browser.fontenhance'} eq 'on') || 
Line 1350  sub start_font { Line 1364  sub start_font {
 sub end_font {  sub end_font {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }  elsif ($target eq 'tex') {      }  elsif ($target eq 'tex') {
  my $fontsize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval);   my $fontsize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval);
Line 1365  sub end_font { Line 1379  sub end_font {
 sub start_strike {  sub start_strike {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  &Apache::lonxml::startredirection();   &Apache::lonxml::startredirection();
Line 1376  sub start_strike { Line 1390  sub start_strike {
 sub end_strike {  sub end_strike {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring=&Apache::lonxml::endredirection();   $currentstring=&Apache::lonxml::endredirection();
Line 1391  sub end_strike { Line 1405  sub end_strike {
 sub start_s {  sub start_s {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  &Apache::lonxml::startredirection();   &Apache::lonxml::startredirection();
Line 1402  sub start_s { Line 1416  sub start_s {
 sub end_s {  sub end_s {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring=&Apache::lonxml::endredirection();   $currentstring=&Apache::lonxml::endredirection();
Line 1417  sub end_s { Line 1431  sub end_s {
 sub start_sub {  sub start_sub {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\ensuremath{_{';   $currentstring .= '\ensuremath{_{';
Line 1428  sub start_sub { Line 1442  sub start_sub {
 sub end_sub {  sub end_sub {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}}';   $currentstring .= '}}';
Line 1440  sub end_sub { Line 1454  sub end_sub {
 sub start_sup {  sub start_sup {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\ensuremath{^{';   $currentstring .= '\ensuremath{^{';
Line 1451  sub start_sup { Line 1465  sub start_sup {
 sub end_sup {  sub end_sup {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '}}';   $currentstring .= '}}';
Line 1463  sub end_sup { Line 1477  sub end_sup {
 sub start_hr {  sub start_hr {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = &end_p(); # End enclosing para.      my $currentstring = &end_p(); # End enclosing para.
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $LaTeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0);   my $LaTeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0);
Line 1493  sub start_hr { Line 1507  sub start_hr {
 sub end_hr {  sub end_hr {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     }      }
     return $currentstring;      return $currentstring;
Line 1511  sub end_hr { Line 1525  sub end_hr {
 sub start_div {  sub start_div {
     my ($target,$token, $tagstack, $parstack, $parser, $safeeval) = @_;      my ($target,$token, $tagstack, $parstack, $parser, $safeeval) = @_;
     my $currentstring = &end_p(); # Close enclosing para.      my $currentstring = &end_p(); # Close enclosing para.
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     }       } 
     if ($target eq 'tex') {      if ($target eq 'tex') {
Line 1524  sub start_div { Line 1538  sub start_div {
  if ($align eq 'center') {   if ($align eq 'center') {
     $currentstring .= '\begin{center}';      $currentstring .= '\begin{center}';
     $endstring      = '\end{center}';      $endstring      = '\end{center}';
       if (&is_inside_of($tagstack, "table")) {
    $currentstring = &center_correction().$currentstring;
    #$endstring .= &center_correction();
       }
  }   }
  elsif ($align eq 'right') {   elsif ($align eq 'right') {
     $currentstring .= '\begin{flushright}';      $currentstring .= '\begin{flushright}';
Line 1544  sub start_div { Line 1562  sub start_div {
 sub end_div {  sub end_div {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     }      }
     if ($target eq 'tex') {      if ($target eq 'tex') {
Line 1559  sub end_div { Line 1577  sub end_div {
 sub start_a {  sub start_a {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  my $href=&Apache::lonxml::get_param('href',$parstack,$safeeval,   my $href=&Apache::lonxml::get_param('href',$parstack,$safeeval,
     undef,1);      undef,1);
  $currentstring=&Apache::lonenc::encrypt_ref($token,{'href'=>$href});   $currentstring=&Apache::lonenc::encrypt_ref($token,{'href'=>$href});
Line 1581  sub start_a { Line 1599  sub start_a {
 sub end_a {  sub end_a {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     }      }
     return $currentstring;      return $currentstring;
Line 1591  sub end_a { Line 1609  sub end_a {
 sub start_li {  sub start_li {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0);   my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0);
Line 1622  sub start_li { Line 1640  sub start_li {
 sub end_li {  sub end_li {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = &end_p(); # In case there's a <p> in the <li>      my $currentstring = &end_p(); # In case there's a <p> in the <li>
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];        $currentstring .= $token->[2];     
     }       } 
     return $currentstring;      return $currentstring;
Line 1632  sub end_li { Line 1650  sub end_li {
 sub start_u {  sub start_u {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  &Apache::lonxml::startredirection();   &Apache::lonxml::startredirection();
Line 1643  sub start_u { Line 1661  sub start_u {
 sub end_u {  sub end_u {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring=&Apache::lonxml::endredirection();   $currentstring=&Apache::lonxml::endredirection();
Line 1658  sub end_u { Line 1676  sub end_u {
 sub start_ul {  sub start_ul {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = &end_p(); # Close off enclosing list.      my $currentstring = &end_p(); # Close off enclosing list.
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];        $currentstring .= $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $TeXtype=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0);   my $TeXtype=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0);
Line 1687  sub start_ul { Line 1705  sub start_ul {
 sub end_ul {  sub end_ul {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = '\end{itemize} \renewcommand{\labelitemi}{$\bullet$}'.   $currentstring = '\end{itemize} \renewcommand{\labelitemi}{$\bullet$}'.
Line 1702  sub end_ul { Line 1720  sub end_ul {
 sub start_menu {  sub start_menu {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = " \\begin{itemize} ";     $currentstring = " \\begin{itemize} ";  
Line 1713  sub start_menu { Line 1731  sub start_menu {
 sub end_menu {  sub end_menu {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = " \\end{itemize}";     $currentstring = " \\end{itemize}";  
Line 1725  sub end_menu { Line 1743  sub end_menu {
 sub start_dir {  sub start_dir {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = &end_p(); # In case there's a <p> prior to the list.      my $currentstring = &end_p(); # In case there's a <p> prior to the list.
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];        $currentstring .= $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= " \\begin{itemize} ";     $currentstring .= " \\begin{itemize} ";  
Line 1736  sub start_dir { Line 1754  sub start_dir {
 sub end_dir {  sub end_dir {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = " \\end{itemize}";     $currentstring = " \\end{itemize}";  
Line 1748  sub end_dir { Line 1766  sub end_dir {
 sub start_ol {  sub start_ol {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = &end_p(); # In case there's a <p> prior to the list.      my $currentstring = &end_p(); # In case there's a <p> prior to the list.
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];        $currentstring .= $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $Apache::londefdef::list_index=0;   $Apache::londefdef::list_index=0;
Line 1787  sub start_ol { Line 1805  sub start_ol {
 sub end_ol {  sub end_ol {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = '\end{enumerate}\renewcommand{\labelenumi}{\arabic{enumi}.}'.   $currentstring = '\end{enumerate}\renewcommand{\labelenumi}{\arabic{enumi}.}'.
Line 1802  sub end_ol { Line 1820  sub end_ol {
 sub start_dl {  sub start_dl {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = &end_p(); # In case there's a <p> unclosed prior to the list.      my $currentstring = &end_p(); # In case there's a <p> unclosed prior to the list.
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];        $currentstring .= $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\begin{description}';   $currentstring .= '\begin{description}';
Line 1818  sub start_dl { Line 1836  sub start_dl {
 sub end_dl {  sub end_dl {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  if ($Apache::londefdef::DT[-1]) { &end_dt(@_); }   if ($Apache::londefdef::DT[-1]) { &end_dt(@_); }
Line 1840  sub end_dl { Line 1858  sub end_dl {
 sub start_dt {  sub start_dt {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring='';      my $currentstring='';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  if ($Apache::londefdef::DT[-1]) { &end_dt(@_); }   if ($Apache::londefdef::DT[-1]) { &end_dt(@_); }
Line 1855  sub start_dt { Line 1873  sub start_dt {
 sub end_dt {  sub end_dt {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  if ($Apache::londefdef::DT[-1]) {   if ($Apache::londefdef::DT[-1]) {
Line 1878  sub item_cleanup { Line 1896  sub item_cleanup {
 sub start_dd {  sub start_dd {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  if ($Apache::londefdef::DT[-1]) { &end_dt(@_); }   if ($Apache::londefdef::DT[-1]) { &end_dt(@_); }
Line 1897  sub start_dd { Line 1915  sub start_dd {
 sub end_dd {  sub end_dd {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }  elsif ($target eq 'tex') {      }  elsif ($target eq 'tex') {
  $Apache::londefdef::description[-1]->[-1].=   $Apache::londefdef::description[-1]->[-1].=
Line 1918  sub start_table { Line 1936  sub start_table {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $textwidth = '';      my $textwidth = '';
     my $currentstring = &end_p();      my $currentstring = &end_p();
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];        $currentstring .= $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $aa = {};   my $aa = {};
Line 1944  sub start_table { Line 1962  sub start_table {
   
  # width either comes forced from the TeXwidth or the width parameters.   # width either comes forced from the TeXwidth or the width parameters.
  # in either case it can be a percentage or absolute width.   # in either case it can be a percentage or absolute width.
    # in the width case we ignore absolute width 
  my $TeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0);   my $TeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0);
  if (not defined $TeXwidth) {   if (!defined($TeXwidth)) {
     $TeXwidth = &Apache::lonxml::get_param('width',$parstack,$safeeval,undef,1);      my $htmlwidth = &Apache::lonxml::get_param('width',$parstack,
          $safeeval,undef,1);
       if ($htmlwidth =~ /%/) {
    $TeXwidth = $htmlwidth;
       } else { 
    $TeXwidth = $textwidth;
       }
  } else {   } else {
     $Apache::londefdef::table[-1]{'forcedtablewidth'} = 1;      $Apache::londefdef::table[-1]{'forcedtablewidth'} = 1;
  }   }
Line 1996  sub start_table { Line 2019  sub start_table {
 sub end_table {  sub end_table {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $inmemory = '';   my $inmemory = '';
Line 2188  sub end_table { Line 2211  sub end_table {
  for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) {   for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) {
     for (my $jn=0;$jn<=$#fwidth;$jn++) {      for (my $jn=0;$jn<=$#fwidth;$jn++) {
  if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') {   if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') {
     # $output.='\vspace*{-6 mm}\begin{center}';      $output.=&center_correction().'\begin{center}';
     $output.='\begin{center}';  
  } elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') {   } elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') {
     $output.=' \hfill \llap{'      $output.=' \hfill \llap{'
  }   }
  $output.=$Apache::londefdef::table[-1]{'content'}[$in][$jn];   $output.=$Apache::londefdef::table[-1]{'content'}[$in][$jn];
  if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') {   if ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'c') {
     # $output.='\end{center}\vspace*{-6 mm}';      $output.='\end{center}';#.&center_correction();
     $output.='\end{center}';  
  } elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') {   } elsif ($Apache::londefdef::table[-1]{'align'}[$in][$jn] eq 'r') {
     $output.='} ';      $output.='} ';
  }   }
Line 2250  sub end_table { Line 2271  sub end_table {
 sub start_tr {  sub start_tr {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $Apache::londefdef::table[-1]{'row_number'}++;   $Apache::londefdef::table[-1]{'row_number'}++;
Line 2278  sub start_tr { Line 2299  sub start_tr {
 sub end_tr {  sub end_tr {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = &end_p(); # Close any pending <p> in the row.      my $currentstring = &end_p(); # Close any pending <p> in the row.
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];        $currentstring .= $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  if ($Apache::londefdef::TD_redirection) {   if ($Apache::londefdef::TD_redirection) {
Line 2300  sub end_tr { Line 2321  sub end_tr {
 sub start_td {  sub start_td {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $Apache::londefdef::TD_redirection = 1;   $Apache::londefdef::TD_redirection = 1;
Line 2443  sub end_td_tex { Line 2464  sub end_td_tex {
 sub end_td {  sub end_td {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
         $Apache::londefdef::TD_redirection =0;          $Apache::londefdef::TD_redirection =0;
Line 2456  sub end_td { Line 2477  sub end_td {
 sub start_th {  sub start_th {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $Apache::londefdef::TD_redirection = 1;   $Apache::londefdef::TD_redirection = 1;
Line 2572  sub end_th_tex { Line 2593  sub end_th_tex {
 sub end_th {  sub end_th {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = &end_p(); # Close any open <p> in the row.      my $currentstring = &end_p(); # Close any open <p> in the row.
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];        $currentstring .= $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
         $Apache::londefdef::TD_redirection =0;          $Apache::londefdef::TD_redirection =0;
Line 2596  sub start_img { Line 2617  sub start_img {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_;
     my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval,      my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval,
  undef,1);   undef,1);
     if (not $src and ($target eq 'web' or $target eq 'tex')) {       if (! $src && 
    ($target eq 'web' || $target eq 'webgrade' || $target eq 'tex')
    ) { 
  my $inside = &Apache::lonxml::get_all_text("/img",$parser,$style);   my $inside = &Apache::lonxml::get_all_text("/img",$parser,$style);
  return '';   return '';
     }      }
Line 2606  sub start_img { Line 2629  sub start_img {
   
    # Render unto browsers that which are the browser's...     # Render unto browsers that which are the browser's...
   
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  if ($env{'browser.imagesuppress'} ne 'on') {   if ($env{'browser.imagesuppress'} ne 'on') {
     $currentstring.=&Apache::lonenc::encrypt_ref($token,{'src'=>$src});      $currentstring.=&Apache::lonenc::encrypt_ref($token,{'src'=>$src});
  } else {   } else {
Line 2633  sub start_img { Line 2656  sub start_img {
   $safeeval,    $safeeval,
   undef,1));    undef,1));
  if(!$align) {   if(!$align) {
       # disabled for now see BUG#4535
     if (&is_inside_of($tagstack, "table")) {      if (&is_inside_of($tagstack, "table")) {
  $align = "right";      # Force wraptext use.    $align = "top";      # Force top of image to top of table cell 
     } else {      } else {
  $align = "bottom"; # This is html's default so it's ours too.   $align = "bottom"; # This is html's default so it's ours too.
     }      }
Line 2797  sub start_img { Line 2821  sub start_img {
 sub end_img {  sub end_img {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];   $currentstring = $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = '';   $currentstring = '';
Line 2815  sub start_applet { Line 2839  sub start_applet {
    undef,1);     undef,1);
     &Apache::lonxml::extlink($archive);      &Apache::lonxml::extlink($archive);
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  if ($env{'browser.appletsuppress'} ne 'on') {   if ($env{'browser.appletsuppress'} ne 'on') {
     $currentstring = &Apache::lonenc::encrypt_ref($token,      $currentstring = &Apache::lonenc::encrypt_ref($token,
   {'code'=>$code,    {'code'=>$code,
Line 2848  sub start_applet { Line 2872  sub start_applet {
 sub end_applet {  sub end_applet {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];   $currentstring = $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
     }       } 
Line 2861  sub start_embed { Line 2885  sub start_embed {
     my $src=&Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1);      my $src=&Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1);
     &Apache::lonxml::extlink($src);      &Apache::lonxml::extlink($src);
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  if ($env{'browser.embedsuppress'} ne 'on') {   if ($env{'browser.embedsuppress'} ne 'on') {
     $currentstring=&Apache::lonenc::encrypt_ref($token,{'src'=>$src});      $currentstring=&Apache::lonenc::encrypt_ref($token,{'src'=>$src});
  } else {   } else {
Line 2880  sub start_embed { Line 2904  sub start_embed {
 sub end_embed {  sub end_embed {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {        } elsif ($target eq 'tex') {  
     }       } 
Line 2900  sub start_param { Line 2924  sub start_param {
     my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1);      my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1);
     &Apache::lonxml::extlink($src);      &Apache::lonxml::extlink($src);
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  my %toconvert;   my %toconvert;
  my $src=&Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1);   my $src=&Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1);
  if ($src) { $toconvert{'src'}= $src; }   if ($src) { $toconvert{'src'}= $src; }
Line 2919  sub start_param { Line 2943  sub start_param {
 sub end_param {  sub end_param {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];        $currentstring = $token->[2];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
     }       } 
Line 2957  sub end_allow { Line 2981  sub end_allow {
 sub start_frameset {  sub start_frameset {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = ''; # Close any pending para.      my $currentstring = ''; # Close any pending para.
     if ($target eq 'web') {       if ($target eq 'web' || $target eq 'webgrade') { 
  if (!$Apache::lonxml::registered &&   if (!$Apache::lonxml::registered &&
     $env{'request.state'} eq 'published') {      $env{'request.state'} eq 'published') {
     $currentstring.='<head>'.      $currentstring.='<head>'.
Line 2993  sub start_frameset { Line 3017  sub start_frameset {
 sub end_frameset {  sub end_frameset {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];   $currentstring = $token->[2];
     }      }
     return $currentstring;      return $currentstring;
Line 3003  sub end_frameset { Line 3027  sub end_frameset {
 sub start_xmp {  sub start_xmp {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\begin{verbatim}';   $currentstring .= '\begin{verbatim}';
Line 3014  sub start_xmp { Line 3038  sub start_xmp {
 sub end_xmp {  sub end_xmp {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\end{verbatim}';   $currentstring .= '\end{verbatim}';
Line 3026  sub end_xmp { Line 3050  sub end_xmp {
 sub start_pre {  sub start_pre {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = &end_p(); # close off pending <p>      my $currentstring = &end_p(); # close off pending <p>
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];   $currentstring .= $token->[4];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\begin{verbatim}';   $currentstring .= '\begin{verbatim}';
Line 3037  sub start_pre { Line 3061  sub start_pre {
 sub end_pre {  sub end_pre {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[2];   $currentstring .= $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring .= '\end{verbatim}';   $currentstring .= '\end{verbatim}';
Line 3049  sub end_pre { Line 3073  sub end_pre {
 sub start_insert {  sub start_insert {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  my $display = &Apache::lonxml::get_param('display',$parstack,$safeeval,undef,1);   my $display = &Apache::lonxml::get_param('display',$parstack,$safeeval,undef,1);
  $currentstring .= '<b>'.$display.'</b>';;   $currentstring .= '<b>'.$display.'</b>';;
     }      }
Line 3059  sub start_insert { Line 3083  sub start_insert {
 sub end_insert {  sub end_insert {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= '';   $currentstring .= '';
     }      }
     return $currentstring;      return $currentstring;
Line 3069  sub end_insert { Line 3093  sub end_insert {
 sub start_externallink {  sub start_externallink {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  my $display = &Apache::lonxml::get_param('display',$parstack,$safeeval,undef,1);   my $display = &Apache::lonxml::get_param('display',$parstack,$safeeval,undef,1);
  $currentstring .= '<b>'.$display.'</b>';;   $currentstring .= '<b>'.$display.'</b>';;
     }      }
Line 3079  sub start_externallink { Line 3103  sub start_externallink {
 sub end_externallink {  sub end_externallink {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= '';   $currentstring .= '';
     }      }
     return $currentstring;      return $currentstring;
Line 3109  sub end_blankspace { Line 3133  sub end_blankspace {
 sub start_abbr {  sub start_abbr {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3118  sub start_abbr { Line 3142  sub start_abbr {
 sub end_abbr {  sub end_abbr {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3128  sub end_abbr { Line 3152  sub end_abbr {
 sub start_acronym {  sub start_acronym {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3137  sub start_acronym { Line 3161  sub start_acronym {
 sub end_acronym {  sub end_acronym {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3147  sub end_acronym { Line 3171  sub end_acronym {
 sub start_area {  sub start_area {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3156  sub start_area { Line 3180  sub start_area {
 sub end_area {  sub end_area {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3166  sub end_area { Line 3190  sub end_area {
 sub start_base {  sub start_base {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }      }
     return $currentstring;      return $currentstring;
Line 3175  sub start_base { Line 3199  sub start_base {
 sub end_base {  sub end_base {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3185  sub end_base { Line 3209  sub end_base {
 sub start_bdo {  sub start_bdo {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3194  sub start_bdo { Line 3218  sub start_bdo {
 sub end_bdo {  sub end_bdo {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3204  sub end_bdo { Line 3228  sub end_bdo {
 sub start_bgsound {  sub start_bgsound {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3213  sub start_bgsound { Line 3237  sub start_bgsound {
 sub end_bgsound {  sub end_bgsound {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3223  sub end_bgsound { Line 3247  sub end_bgsound {
 sub start_blink {  sub start_blink {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3232  sub start_blink { Line 3256  sub start_blink {
 sub end_blink {  sub end_blink {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3242  sub end_blink { Line 3266  sub end_blink {
 sub start_blockquote {  sub start_blockquote {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = &end_p(); # Close any unclosed <p>      my $currentstring = &end_p(); # Close any unclosed <p>
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];        $currentstring .= $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3251  sub start_blockquote { Line 3275  sub start_blockquote {
 sub end_blockquote {  sub end_blockquote {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3261  sub end_blockquote { Line 3285  sub end_blockquote {
 sub start_button {  sub start_button {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3270  sub start_button { Line 3294  sub start_button {
 sub end_button {  sub end_button {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3280  sub end_button { Line 3304  sub end_button {
 sub start_caption {  sub start_caption {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3289  sub start_caption { Line 3313  sub start_caption {
 sub end_caption {  sub end_caption {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3299  sub end_caption { Line 3323  sub end_caption {
 sub start_col {  sub start_col {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3308  sub start_col { Line 3332  sub start_col {
 sub end_col {  sub end_col {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3318  sub end_col { Line 3342  sub end_col {
 sub start_colgroup {  sub start_colgroup {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3327  sub start_colgroup { Line 3351  sub start_colgroup {
 sub end_colgroup {  sub end_colgroup {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3337  sub end_colgroup { Line 3361  sub end_colgroup {
 sub start_del {  sub start_del {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3346  sub start_del { Line 3370  sub start_del {
 sub end_del {  sub end_del {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3356  sub end_del { Line 3380  sub end_del {
 sub start_fieldset {  sub start_fieldset {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3365  sub start_fieldset { Line 3389  sub start_fieldset {
 sub end_fieldset {  sub end_fieldset {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3375  sub end_fieldset { Line 3399  sub end_fieldset {
 sub start_frame {  sub start_frame {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3384  sub start_frame { Line 3408  sub start_frame {
 sub end_frame {  sub end_frame {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3394  sub end_frame { Line 3418  sub end_frame {
 sub start_iframe {  sub start_iframe {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3403  sub start_iframe { Line 3427  sub start_iframe {
 sub end_iframe {  sub end_iframe {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3413  sub end_iframe { Line 3437  sub end_iframe {
 sub start_ins {  sub start_ins {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3422  sub start_ins { Line 3446  sub start_ins {
 sub end_ins {  sub end_ins {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3432  sub end_ins { Line 3456  sub end_ins {
 sub start_isindex {  sub start_isindex {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3441  sub start_isindex { Line 3465  sub start_isindex {
 sub end_isindex {  sub end_isindex {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3451  sub end_isindex { Line 3475  sub end_isindex {
 sub start_keygen {  sub start_keygen {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3460  sub start_keygen { Line 3484  sub start_keygen {
 sub end_keygen {  sub end_keygen {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3470  sub end_keygen { Line 3494  sub end_keygen {
 sub start_label {  sub start_label {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3479  sub start_label { Line 3503  sub start_label {
 sub end_label {  sub end_label {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3489  sub end_label { Line 3513  sub end_label {
 sub start_layer {  sub start_layer {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3498  sub start_layer { Line 3522  sub start_layer {
 sub end_layer {  sub end_layer {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3508  sub end_layer { Line 3532  sub end_layer {
 sub start_legend {  sub start_legend {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3517  sub start_legend { Line 3541  sub start_legend {
 sub end_legend {  sub end_legend {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3527  sub end_legend { Line 3551  sub end_legend {
 sub start_link {  sub start_link {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  my $href=&Apache::lonxml::get_param('href',$parstack,$safeeval,   my $href=&Apache::lonxml::get_param('href',$parstack,$safeeval,
     undef,1);      undef,1);
  &Apache::lonxml::extlink($href);   &Apache::lonxml::extlink($href);
Line 3539  sub start_link { Line 3563  sub start_link {
 sub end_link {  sub end_link {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3549  sub end_link { Line 3573  sub end_link {
 sub start_marquee {  sub start_marquee {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3558  sub start_marquee { Line 3582  sub start_marquee {
 sub end_marquee {  sub end_marquee {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3568  sub end_marquee { Line 3592  sub end_marquee {
 sub start_multicol {  sub start_multicol {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = &end_p(); # Close any pending <p>      my $currentstring = &end_p(); # Close any pending <p>
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];        $currentstring .= $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3577  sub start_multicol { Line 3601  sub start_multicol {
 sub end_multicol {  sub end_multicol {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3587  sub end_multicol { Line 3611  sub end_multicol {
 sub start_nobr {  sub start_nobr {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }  elsif ($target eq 'tex') {      }  elsif ($target eq 'tex') {
  $currentstring='\mbox{';   $currentstring='\mbox{';
Line 3598  sub start_nobr { Line 3622  sub start_nobr {
 sub end_nobr {  sub end_nobr {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }   elsif ($target eq 'tex') {      }   elsif ($target eq 'tex') {
  $currentstring='}';   $currentstring='}';
Line 3610  sub end_nobr { Line 3634  sub end_nobr {
 sub start_noembed {  sub start_noembed {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3619  sub start_noembed { Line 3643  sub start_noembed {
 sub end_noembed {  sub end_noembed {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3629  sub end_noembed { Line 3653  sub end_noembed {
 sub start_noframes {  sub start_noframes {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3638  sub start_noframes { Line 3662  sub start_noframes {
 sub end_noframes {  sub end_noframes {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3648  sub end_noframes { Line 3672  sub end_noframes {
 sub start_nolayer {  sub start_nolayer {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3657  sub start_nolayer { Line 3681  sub start_nolayer {
 sub end_nolayer {  sub end_nolayer {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3667  sub end_nolayer { Line 3691  sub end_nolayer {
 sub start_noscript {  sub start_noscript {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3676  sub start_noscript { Line 3700  sub start_noscript {
 sub end_noscript {  sub end_noscript {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3686  sub end_noscript { Line 3710  sub end_noscript {
 sub start_object {  sub start_object {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3695  sub start_object { Line 3719  sub start_object {
 sub end_object {  sub end_object {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3705  sub end_object { Line 3729  sub end_object {
 sub start_optgroup {  sub start_optgroup {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3714  sub start_optgroup { Line 3738  sub start_optgroup {
 sub end_optgroup {  sub end_optgroup {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3724  sub end_optgroup { Line 3748  sub end_optgroup {
 sub start_samp {  sub start_samp {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring='\texttt{';   $currentstring='\texttt{';
Line 3735  sub start_samp { Line 3759  sub start_samp {
 sub end_samp {  sub end_samp {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring='}';   $currentstring='}';
Line 3747  sub end_samp { Line 3771  sub end_samp {
 sub start_server {  sub start_server {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3756  sub start_server { Line 3780  sub start_server {
 sub end_server {  sub end_server {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3766  sub end_server { Line 3790  sub end_server {
 sub start_spacer {  sub start_spacer {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = &end_p(); # Close off any open <p> tag.      my $currentstring = &end_p(); # Close off any open <p> tag.
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring .= $token->[4];        $currentstring .= $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3775  sub start_spacer { Line 3799  sub start_spacer {
 sub end_spacer {  sub end_spacer {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3785  sub end_spacer { Line 3809  sub end_spacer {
 sub start_span {  sub start_span {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3794  sub start_span { Line 3818  sub start_span {
 sub end_span {  sub end_span {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3804  sub end_span { Line 3828  sub end_span {
 sub start_tbody {  sub start_tbody {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3813  sub start_tbody { Line 3837  sub start_tbody {
 sub end_tbody {  sub end_tbody {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3823  sub end_tbody { Line 3847  sub end_tbody {
 sub start_tfoot {  sub start_tfoot {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3832  sub start_tfoot { Line 3856  sub start_tfoot {
 sub end_tfoot {  sub end_tfoot {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3842  sub end_tfoot { Line 3866  sub end_tfoot {
 sub start_thead {  sub start_thead {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3851  sub start_thead { Line 3875  sub start_thead {
 sub end_thead {  sub end_thead {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3861  sub end_thead { Line 3885  sub end_thead {
 sub start_var {  sub start_var {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = '\textit{';    $currentstring = '\textit{'; 
Line 3872  sub start_var { Line 3896  sub start_var {
 sub end_var {  sub end_var {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];   $currentstring = $token->[2];
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $currentstring = '}';    $currentstring = '}'; 
Line 3884  sub end_var { Line 3908  sub end_var {
 sub start_wbr {  sub start_wbr {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[4];        $currentstring = $token->[4];     
     }       } 
     return $currentstring;      return $currentstring;
Line 3893  sub start_wbr { Line 3917  sub start_wbr {
 sub end_wbr {  sub end_wbr {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = $token->[2];       $currentstring = $token->[2];    
     }       } 
     return $currentstring;      return $currentstring;
Line 3902  sub end_wbr { Line 3926  sub end_wbr {
 #-- <hideweboutput> tag  #-- <hideweboutput> tag
 sub start_hideweboutput {  sub start_hideweboutput {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  &Apache::lonxml::startredirection();        &Apache::lonxml::startredirection();     
     }       } 
     return '';      return '';
Line 3911  sub start_hideweboutput { Line 3935  sub start_hideweboutput {
 sub end_hideweboutput {  sub end_hideweboutput {
     my ($target,$token) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web' || $target eq 'webgrade') {
  $currentstring = &Apache::lonxml::endredirection();       $currentstring = &Apache::lonxml::endredirection();    
     }       } 
     return '';      return '';

Removed from v.1.302  
changed lines
  Added in v.1.302.2.5


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