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

version 1.302, 2005/12/06 22:55:31 version 1.302.2.1, 2006/01/04 23:15:52
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) = @_;      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') {
  $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') {
  $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 1183  sub start_p { Line 1192  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 1524  sub start_div { Line 1537  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 1946  sub start_table { Line 1963  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 (not defined $TeXwidth) {   if (!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 2188  sub end_table { Line 2205  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 2633  sub start_img { Line 2648  sub start_img {
   $safeeval,    $safeeval,
   undef,1));    undef,1));
  if(!$align) {   if(!$align) {
     if (&is_inside_of($tagstack, "table")) {      # disabled for now see BUG#4535
       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  
changed lines
  Added in v.1.302.2.1


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