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

sakharuk lon-capa-cvs@mail.lon-capa.org
Mon, 07 Oct 2002 17:57:37 -0000


sakharuk		Mon Oct  7 13:57:37 2002 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
  Attribute TeXwidth in <img> tag can now understand "%", defining haw big
  eps figure is. 
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.89 loncom/xml/londefdef.pm:1.90
--- loncom/xml/londefdef.pm:1.89	Mon Sep 16 15:06:57 2002
+++ loncom/xml/londefdef.pm	Mon Oct  7 13:57:37 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.89 2002/09/16 19:06:57 sakharuk Exp $
+# $Id: londefdef.pm,v 1.90 2002/10/07 17:57:37 sakharuk Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -1549,7 +1549,7 @@
             my $currentstring = '';
 	    my $width_param = '';
 	    my $height_param = '';
-	    my $scaling = .3; 
+	    my $scaling = .3;
 
 	    if ($target eq 'web') {
               $currentstring = $token->[4];     
@@ -1568,10 +1568,14 @@
 		  my $TeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval); 
 		  my $TeXheight = &Apache::lonxml::get_param('TeXheight',$parstack,$safeeval); 
 		  my $width = &Apache::lonxml::get_param('width',$parstack,$safeeval);
-		  if ($TeXwidth ne '') { 
-		      $width_param = $TeXwidth; 
-		  } elsif ($TeXheight ne '') { 
-		      $width_param = $TeXheight/$height_param*$width_param;
+		  if ($TeXwidth ne '') {  
+		      if ($TeXwidth=~/(\d+)\s*\%/) {
+			  $width_param = $1*$ENV{'form.textwidth'}/100;
+		      } else { 
+			  $width_param = $TeXwidth;
+		      }
+		  } elsif ($TeXheight ne '') {
+			  $width_param = $TeXheight/$height_param*$width_param;
 		  } elsif ($width ne '') {
 		      $width_param = $width*$scaling;      
 		  }