[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm

sakharuk lon-capa-cvs@mail.lon-capa.org
Tue, 13 May 2003 15:28:32 -0000


sakharuk		Tue May 13 11:28:32 2003 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
   Changes to print problems with answers.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.163 loncom/interface/lonprintout.pm:1.164
--- loncom/interface/lonprintout.pm:1.163	Mon May 12 16:29:39 2003
+++ loncom/interface/lonprintout.pm	Tue May 13 11:28:32 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.163 2003/05/12 20:29:39 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.164 2003/05/13 15:28:32 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1383,19 +1383,13 @@
 	    &Apache::lonnet::delenv('form.grade_target','form.textwidth','form.counter');
 	    if($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
 		$moreenv{'form.grade_target'}='answer';
+		$moreenv{'form.print_answer'}='yes';
 		&Apache::lonnet::appenv(%moreenv);
 		my $answer=&Apache::lonnet::ssi($currentURL);
-		&Apache::lonnet::delenv('form.grade_target');
-		my $start=index($answer,'<table',0);
-		my $finish=index($answer,'</table>',$start);
-		if ($start!=-1 && $finish!=-1) {$answer=substr($answer,$start,$finish-$start+8);}
-		$answer=~s/<\/td>\s*<td>/ \\\\ \\hline /g;
-                $answer=~s/<table([^>]*)>/\\vskip 0 mm \\begin{tabular}{|c|}\\hline /;
-	        $answer=~s/<\/table>/\\end{tabular}\\vskip 0 mm/;
-	        $answer=~s/<tr>\s*<td>//;
-	        $answer=~s/<\/td>\s*<\/tr>/\\\\ \\hline /;
-	        $answer=~s/<b>([^\#]*)<\/b>/\\verb|$1|/;
-	        $answer=~s/<i>([^\#]*)<\/i>/\\textit{$1}/;
+		&Apache::lonnet::delenv('form.grade_target','form.print_answer');
+		my $start=index($answer,'\vskip 0 mm',0);
+		my $finish=rindex $answer,'\vskip 0 mm' ;
+		if ($start!=-1 && $finish!=-1) {$answer=substr($answer,$start,$finish-$start+12);}
 #		$r->print('<pre>'.$answer.'</pre>'); return OK;
 		$texversion=~s/(\\end{document})/$answer$1/;
 	    }