[LON-CAPA-cvs] cvs: loncom /homework imageresponse.pm

foxr lon-capa-cvs@mail.lon-capa.org
Tue, 07 Jun 2005 22:43:11 -0000


foxr		Tue Jun  7 18:43:11 2005 EDT

  Modified files:              
    /loncom/homework	imageresponse.pm 
  Log:
  Make this able to understand dynamically generated images (e.g. from gnuplot)
  using the %DYNAMICIMAGE comment scheme in tex target.
  
  
Index: loncom/homework/imageresponse.pm
diff -u loncom/homework/imageresponse.pm:1.69 loncom/homework/imageresponse.pm:1.70
--- loncom/homework/imageresponse.pm:1.69	Mon May 23 07:02:59 2005
+++ loncom/homework/imageresponse.pm	Tue Jun  7 18:43:08 2005
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # image click response style
 #
-# $Id: imageresponse.pm,v 1.69 2005/05/23 11:02:59 foxr Exp $
+# $Id: imageresponse.pm,v 1.70 2005/06/07 22:43:08 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -477,8 +477,13 @@
 	#  Gnuplot e.g. just generates the latex to put inplace.
 	#
 	my $graphinclude;
-	if ($src =~ /^\\graphicspath/) {
+	if ($src =~ /^%DYNAMICIMAGE/) {
+	    # This is needed because the newline is not always passed -> tex.
+	    # At present we don't care about the sizing info.
+
+	    my ($commentline, $restofstuff) = split(/\n/, $src);
 	    $graphinclude = $src;
+	    $graphinclude =~ s/^$commentline//;
 	} else {
 	    my ($path,$file) = &Apache::londefdef::get_eps_image($src);
 	    my ($height_param,$width_param)=