[LON-CAPA-cvs] cvs: loncom /xml londefdef.pm

sakharuk lon-capa-cvs@mail.lon-capa.org
Mon, 03 Feb 2003 19:10:29 -0000


sakharuk		Mon Feb  3 14:10:29 2003 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
  Correction was done to the width of the table in the case of one column table.
  Checked on two dozens problems. Works well but the case of nested one column tables does not supported yet. Working on more global changes. 
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.108 loncom/xml/londefdef.pm:1.109
--- loncom/xml/londefdef.pm:1.108	Thu Jan 30 18:30:24 2003
+++ loncom/xml/londefdef.pm	Mon Feb  3 14:10:28 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.108 2003/01/30 23:30:24 albertel Exp $
+# $Id: londefdef.pm,v 1.109 2003/02/03 19:10:28 sakharuk Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -1434,6 +1434,9 @@
 		    my $shorthand = ($filled_columns+1)*4;
 		    $output =~ s/\$SpacePerColumn/$SpacePerColumn - $shorthand mm/g;
 		}	
+		if ($how_many_columns==1) {  #start of block with width correction for one column table
+		  $output=~s/^\s*\\parbox{([^}]*)}/\\parbox{\\textwidth - 1 cm}/;
+		}                            #end of block with width correction for one column table
 		$Apache::londefdef::table[-1]{'output'} .= $header_of_table.$output.$Apache::londefdef::table[-1]{'hinc'}.'\end{tabular}\vskip 0 mm ';
 		if ($#Apache::londefdef::table > 0) {
 		    $inmemory = $Apache::londefdef::table[-1]{'output'};
@@ -1487,7 +1490,7 @@
             my $currentstring = '';
             if ($target eq 'web') {
               $currentstring = $token->[4];     
-    } elsif ($target eq 'tex') {
+	    } elsif ($target eq 'tex') {
 		my $what_to_push = substr(&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1),0,1);
 		if ($what_to_push eq '') {
 		    $what_to_push = substr($Apache::londefdef::table[-1]{'rows'}[0],0,1);;
@@ -1495,7 +1498,6 @@
 		    push @{ $Apache::londefdef::table[-1]{'columns'} }, $what_to_push;
 		$Apache::londefdef::table[-1]{'counter_columns'}++;
 		&Apache::lonxml::startredirection();
-;
 	    } 
 	   return $currentstring;
 	}