--- loncom/build/lpml_html_posteval.pl 2001/12/07 04:44:48 1.3 +++ loncom/build/lpml_html_posteval.pl 2001/12/15 20:20:11 1.4 @@ -3,7 +3,7 @@ # The LearningOnline Network with CAPA # lpml_html_posteval.pl - runs posteval lpml statements in a lpml document. # -# $Id: lpml_html_posteval.pl,v 1.3 2001/12/07 04:44:48 harris41 Exp $ +# $Id: lpml_html_posteval.pl,v 1.4 2001/12/15 20:20:11 harris41 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -34,20 +34,33 @@ use strict; +my %chash; while(<>) { my $line=$_; my $arguments=''; - if ($line=~/\<\!\-\- POSTEVAL (.*?) \-\-\>/) { - $arguments=$1; + my $category=''; + if ($line=~/\<\!\-\- POSTEVAL \[(.+)\] (.*?) \-\-\>/) { + $category=$1; + $arguments=$2; } if ($arguments=~/^verify\.pl /) { my @values=`perl $arguments`; my $ret=join('',@values); - $ret='good' unless $ret; - $line=~s/<\!\-\- POSTEVAL .*? \-\-\>/$ret/; + unless ($ret) { + $ret='correct'; + } + else { + $chash{$category}++; + $ret="$ret"; + } + $line=~s/\<\!\-\- POSTEVAL .*? \-\-\>/$ret/; } elsif ($arguments=~/^byteandlinecount/) { } + if ($line=~/\<\!\-\- POSTEVALINLINE (.*?) \-\-\>/) { + my $count=$chash{$1}+0; + $line=~s/<\!\-\- POSTEVALINLINE .*? \-\-\>/$count/; + } print $line; }