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

sakharuk lon-capa-cvs@mail.lon-capa.org
Wed, 07 May 2003 17:24:16 -0000


sakharuk		Wed May  7 13:24:16 2003 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
   Another correction for the calculation of the cell's width. It is important for the cases where you have real number (not integer) for the width of the object in the cell (it frequently happens when the size of the picture is determined dynamically and not specified in TeXwidth attribute).
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.131 loncom/xml/londefdef.pm:1.132
--- loncom/xml/londefdef.pm:1.131	Wed May  7 12:59:01 2003
+++ loncom/xml/londefdef.pm	Wed May  7 13:24:16 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.131 2003/05/07 16:59:01 sakharuk Exp $
+# $Id: londefdef.pm,v 1.132 2003/05/07 17:24:16 sakharuk Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -1894,7 +1894,7 @@
 	} else {
 	    if ($data=~m/width\s*=\s*(\d+\.?\d*\s*(mm|cm|in|pc|pt)*)/) {
 		my $current_length=&recalc($1);
-		$current_length=~/(\d+)/;
+		$current_length=~/(\d+\.?\d*)/;
 		$Apache::londefdef::table[-1]{'TeXlength'} .= $1.',';
 		$Apache::londefdef::table[-1]{'length'} .= '0,';
 	    } else {     
@@ -3123,7 +3123,7 @@
 sub recalc {
     my $argument = shift;
     if (not $argument=~/(mm|cm|in|pc|pt)/) {return $argument.' mm';}
-    $argument=~/\s*(\d+)\s*(mm|cm|in|pc|pt)/;
+    $argument=~/\s*(\d+\.?\d*)\s*(mm|cm|in|pc|pt)/;
     my $value=$1;
     my $units=$2;
     if ($units eq 'cm') {