[LON-CAPA-cvs] cvs: loncom /homework randomlabel.pm /xml londefdef.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 07 Nov 2006 02:39:58 -0000
albertel Mon Nov 6 21:39:58 2006 EDT
Modified files:
/loncom/xml londefdef.pm
/loncom/homework randomlabel.pm
Log:
- some style
- eliminate uneeded vars
- LaTReX doesn't like spaces in paths either...
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.343 loncom/xml/londefdef.pm:1.344
--- loncom/xml/londefdef.pm:1.343 Mon Nov 6 18:45:00 2006
+++ loncom/xml/londefdef.pm Mon Nov 6 21:39:39 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Tags Default Definition Module
#
-# $Id: londefdef.pm,v 1.343 2006/11/06 23:45:00 foxr Exp $
+# $Id: londefdef.pm,v 1.344 2006/11/07 02:39:39 albertel Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -1916,8 +1916,7 @@
if ($target eq 'web' || $target eq 'webgrade') {
$currentstring .= $token->[4];
} elsif ($target eq 'tex') {
- my $aa = {};
- push @Apache::londefdef::table, $aa;
+ push(@Apache::londefdef::table, {});
$Apache::londefdef::table[-1]{'row_number'} = -1;
#maximum table's width (default coincides with text line length)
if ($#Apache::londefdef::table==0) {
@@ -2859,8 +2858,6 @@
&Apache::lonxml::debug("$src exists");
my ($height_param,$width_param)=
&image_size($origsrc,0.3,$parstack,$safeeval);
- my $destpath = $path;
- my $destfile = $file;
my $size;
if ($width_param) { $size.='width='.$width_param.' mm,'; }
if ($height_param) { $size.='height='.$height_param.' mm]'; }
@@ -2870,8 +2867,8 @@
$size='['.$size;
$size=~s/,$/]/;
- $currentstring .= '\graphicspath{{'.$destpath.'}}'
- .'\includegraphics'.$size.'{'.$destfile.'} ';
+ $currentstring .= '\graphicspath{{'.$path.'}}'
+ .'\includegraphics'.$size.'{'.$file.'} ';
# If there's an alignment specification we need to honor it here.
# For the horizontal alignments, we will also honor the
@@ -4238,7 +4235,7 @@
&Apache::lonnet::repcopy($orig_src); # Failure is not completely fatal.
}
&Apache::lonxml::debug("get_eps_image: Original image: $orig_src");
- my ($spath, $sname, $sext) = fileparse($src, qr/\.(gif|png|jpg|jpeg)/i);
+ my ($spath, $sname, $sext) = &fileparse($src, qr/\.(gif|png|jpg|jpeg)/i);
$src=~s/\.(gif|png|jpg|jpeg)$/\.eps/i;
$src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);
&Apache::lonxml::debug("Filelocation gives: $src");
@@ -4263,8 +4260,8 @@
my $newsrc=$orig_src;
$newsrc =~ s|(.*)/res/|/home/httpd/html/res/|;
&Apache::lonxml::debug("queueing $newsrc for dynamic eps production.");
- print FILE "$newsrc\n";
- close FILE;
+ print FILE ("$newsrc\n");
+ close(FILE);
$src=~s|/home/httpd/html/res|/home/httpd/prtspool|;
$src=~s|/home/([^/]*)/public_html/|/home/httpd/prtspool/$1/|;
if ($sext ne "") { # Put the ext. back in to uniquify.
@@ -4288,6 +4285,7 @@
$src=~s|/home/([^/]*)/public_html/|/home/httpd/prtspool/$1/|;
}
my ($path,$file)=($src=~m|(.*)/([^/]*)$|);
+ $path =~ s/ /\_/g;
$file =~ s/ /\_/g;
&Apache::lonxml::debug("get_eps_image returning: $path / $file<BR />");
return ($path.'/',$file);
Index: loncom/homework/randomlabel.pm
diff -u loncom/homework/randomlabel.pm:1.84 loncom/homework/randomlabel.pm:1.85
--- loncom/homework/randomlabel.pm:1.84 Mon Nov 6 18:44:42 2006
+++ loncom/homework/randomlabel.pm Mon Nov 6 21:39:58 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# random labelling tool
#
-# $Id: randomlabel.pm,v 1.84 2006/11/06 23:44:42 foxr Exp $
+# $Id: randomlabel.pm,v 1.85 2006/11/07 02:39:58 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -296,18 +296,11 @@
&Apache::lonxml::debug("Image size: $height_param x $width_param");
my $dirtywidth=$width_param+5;
- #
- # Note that lonprintout/prinout will conspire to replace
- # spaces in paths and names with _'s since spacess cause problems
- # for latex included filenames. Therefore:
- #
- my $safe_path = $path;
- my $safe_file = $file;
my $result ="\n".'\vspace*{2mm}\noindent'."\n".
'\parbox{'.$dirtywidth.
' mm}{ \noindent \epsfxsize='.$width_param.
- ' mm \epsffile{'.$safe_path.$safe_file.
+ ' mm \epsffile{'.$path.$file.
'}\setlength{\unitlength}{1mm}'."\n".' \begin{picture}('.
$width_param.','.$height_param.')(0,-'.$height_param.')'."\n";
my $magick = Image::Magick->new;