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

sakharuk lon-capa-cvs@mail.lon-capa.org
Thu, 01 Aug 2002 19:47:29 -0000


sakharuk		Thu Aug  1 15:47:29 2002 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
  
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.81 loncom/xml/londefdef.pm:1.82
--- loncom/xml/londefdef.pm:1.81	Thu Aug  1 14:15:09 2002
+++ loncom/xml/londefdef.pm	Thu Aug  1 15:47:29 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.81 2002/08/01 18:15:09 sakharuk Exp $
+# $Id: londefdef.pm,v 1.82 2002/08/01 19:47:29 sakharuk Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -1039,7 +1039,7 @@
             if ($target eq 'web') {
 	       $currentstring .= $token->[4];
 	    } elsif ($target eq 'tex') {
-		$currentstring .= '\vskip 0 mm \noindent\makebox[\textwidth - 8 mm][b]{\hrulefill}';
+		$currentstring .= '\vskip 0 mm \noindent\makebox[\textwidth ][b]{\hrulefill}\vskip 0 mm ';
 	    } 
            return $currentstring;
 	}
@@ -1325,9 +1325,11 @@
 		my $filled_columns = 0;
 		foreach my $tempo_length (@{ $Apache::londefdef::table[-1]{'lengthrow'} }) {
 		    my @length = split(/,/,$tempo_length);
+		    my $nfilled_columns = 0; 
 		    for (my $ico=0;$ico<$how_many_columns;$ico++) {
-			if (not $lengthforoutput[$ico]=~m/\s*0\s*/) {$filled_columns++;}
+			if (not $lengthforoutput[$ico]=~m/\s*0\s*/) {$nfilled_columns++;}
 		    }
+		    if ($nfilled_columns > $filled_columns) {$filled_columns=$nfilled_columns;}
 		}
 		my $temp_file;
 		my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.tbl";
@@ -1381,7 +1383,7 @@
                 for (my $io=0; $io<=$#lengthforoutput;$io++) {
 		    $parboxlength .= ' - '.$lengthforoutput[$io].' ';
 		}
-		$parboxlength .= ')/($GLOBALnumberOFcolumns+1) - 1 mm';
+		$parboxlength .= ')/($GLOBALnumberOFcolumns+1) - 3 mm';
 		$output =~ s/\\parbox{}{}/\\parbox{1 mm}{}/g;
 		$output =~ s/\\parbox{}{(\\textbf{\w?\.?})}/\\parbox{5 mm}{$1}/g; #for stupid tables with empty columns
 		$output =~ s/\\parbox{}/\\parbox{$parboxlength}/g;
@@ -1465,17 +1467,25 @@
         sub end_td {
 	    my ($target,$token) = @_;
             my $currentstring = '';
+            my $tempolen = '';
             if ($target eq 'web') {
 		$currentstring = $token->[2];     
 	    } elsif ($target eq 'tex') {
 		my $current_row = $Apache::londefdef::table[-1]{'row_number'};
 		my $data=&Apache::lonxml::endredirection();
-		if ($data=~m/width\s*=\s*(\d+\.*\d*\s*(mm|cm))/) {                 
-                    $Apache::londefdef::table[-1]{'length'} .= $1.',';        
+		if ($data=~m/width\s*=\s*(\d+\.*\d*\s*(mm|cm|in|pc|pt))/) {                 
+                    $Apache::londefdef::table[-1]{'length'} .= $1.',';
+		    $tempolen = $1;         
 		} else {
-		    $Apache::londefdef::table[-1]{'length'} .= '0 mm,'; 
+		    if (length($data)<5) {
+			$Apache::londefdef::table[-1]{'length'} .= '7 mm,';
+			$tempolen = '5 mm';
+		    } else {
+			$Apache::londefdef::table[-1]{'length'} .= '0 mm,';
+			$tempolen = '';
+		    }
                 }                                        
-		@{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{'.$1.'}{'.$data.'} '.$Apache::londefdef::table[-1]{'vinc'};
+		@{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{'.$tempolen.'}{'.$data.'} '.$Apache::londefdef::table[-1]{'vinc'};
 	    }
 	   return $currentstring;
 	}