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

www lon-capa-cvs-allow@mail.lon-capa.org
Mon, 03 Mar 2008 22:49:56 -0000


www		Mon Mar  3 17:49:56 2008 EDT

  Modified files:              
    /loncom/homework	inputtags.pm 
  Log:
  Bug #1344: cleanup extra whitespace when re-displaying student answer.
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.240 loncom/homework/inputtags.pm:1.241
--- loncom/homework/inputtags.pm:1.240	Mon Mar  3 14:37:27 2008
+++ loncom/homework/inputtags.pm	Mon Mar  3 17:49:55 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.240 2008/03/03 19:37:27 www Exp $
+# $Id: inputtags.pm,v 1.241 2008/03/03 22:49:55 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -306,7 +306,9 @@
 		$oldresponse = $oldresponse->[$#Apache::inputtags::inputlist];
 	    }
 	    $oldresponse = &HTML::Entities::encode($oldresponse,'<>&"');
-
+            $oldresponse =~ s/^\s+//;
+            $oldresponse =~ s/\s+$//;
+            $oldresponse =~ s/\s+/ /g;
 	    if ($Apache::lonhomework::type ne 'exam') {
 		my $addchars=&Apache::lonxml::get_param('addchars',$parstack,$safeeval);
 		$result='';