Diff for /loncom/xml/londefdef.pm between versions 1.302.2.1 and 1.303

version 1.302.2.1, 2006/01/04 23:15:52 version 1.303, 2005/12/19 23:27:33
Line 594  sub end_body { Line 594  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,$tagstack) = @_;      my ($target,$token) = @_;
     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') {
  $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,$tagstack) = @_;      my ($target,$token) = @_;
     my $currentstring = '';      my $currentstring = '';
     if ($target eq 'web') {      if ($target eq 'web') {
  $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 1192  sub start_p { Line 1183  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 1537  sub start_div { Line 1524  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 1963  sub start_table { Line 1946  sub start_table {
  # in either case it can be a percentage or absolute width.   # in either case it can be a percentage or 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 (!defined($TeXwidth)) {   if (not defined $TeXwidth) {
     $TeXwidth = &Apache::lonxml::get_param('width',$parstack,$safeeval,undef,1);      $TeXwidth = &Apache::lonxml::get_param('width',$parstack,$safeeval,undef,1);
     if (!defined($TeXwidth)) { $TeXwidth = $textwidth; }  
  } else {   } else {
     $Apache::londefdef::table[-1]{'forcedtablewidth'} = 1;      $Apache::londefdef::table[-1]{'forcedtablewidth'} = 1;
  }   }
Line 2205  sub end_table { Line 2188  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.=&center_correction().'\begin{center}';      # $output.='\vspace*{-6 mm}\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}'.&center_correction();      # $output.='\end{center}\vspace*{-6 mm}';
       $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 2362  sub start_td_tex { Line 2347  sub start_td_tex {
 sub end_td_tex {  sub end_td_tex {
     my ($parstack,$parser,$safeeval) = @_;      my ($parstack,$parser,$safeeval) = @_;
     my $current_row = $Apache::londefdef::table[-1]{'row_number'};      my $current_row = $Apache::londefdef::table[-1]{'row_number'};
     my $data=&Apache::lonxml::endredirection();      my $data = &Apache::lonxml::endredirection();
   
       # Get the column and row spans.
       # Colspan can be done via \multicolumn if I can figure out the data structs.
       # Rowspan, can be done using the multirow package which adds similar stuff to rowspanning.
   
       my $colspan = &Apache::lonxml::get_param('colspan', $parstack, $safeeval, undef, 0);
       my $rowspan = &Apache::lonxml::get_param('rowspan', $parstack, $safeeval, undef, 0);
       
     my $TeXwidth=&Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0);      my $TeXwidth=&Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0);
     if (defined $TeXwidth) {      if (defined $TeXwidth) {
  push @ {$Apache::londefdef::table[-1]{'objectlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0';   push @ {$Apache::londefdef::table[-1]{'objectlen'}[$Apache::londefdef::table[-1]{'row_number'}] },'0';
Line 2648  sub start_img { Line 2641  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 (0 && &is_inside_of($tagstack, "table")) {  
  $align = "right";      # Force wraptext use.    $align = "right";      # Force wraptext use. 
     } 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.

Removed from v.1.302.2.1  
changed lines
  Added in v.1.303


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