From: Nathaniel Wesley Filardo Date: Mon, 16 Feb 2015 00:16:14 +0000 (-0500) Subject: Add ! dings X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=3d77bd6e56ee8044f5af06550437de7c94444f46;p=grade Add ! dings --- diff --git a/README.rst b/README.rst index 4ebd89f..5c1f346 100644 --- a/README.rst +++ b/README.rst @@ -164,10 +164,17 @@ Within sections, each flag definition takes the form :: . ``flag-name`` is the name of the flag used in the grading data files. -``score-modifier`` is a number (as understood by Perl) and is almost always -negative (i.e., beginning with a ``-``), but positive numbers are understood -for some form of extra credit. (Note that the script will refuse to set a -score higher than the section maximum.) +``score-modifier`` is either + +* a number (as understood by Perl), which adjusts the score of this section + appropriately. As such, this number is almost always negative (i.e., + beginning with a ``-``), but positive numbers are understood for some form + of extra credit. (Note that the script will refuse to set a score higher + than the section maximum.) + +* a ``!`` followed by a number, again, as understood by Perl, usually ``0``. + Engaging a flag so defined will cause the grading script to act as if a + ``!pointsset`` directive was encountered. Text between the line beginning with ``:`` and the dot on a line by itself will be copied into student grade reports whenever the flag is given in a diff --git a/grade.pl b/grade.pl index db8c7a3..c5c92d1 100644 --- a/grade.pl +++ b/grade.pl @@ -83,8 +83,14 @@ sub doDing($) { # {{{ seek DEFINES, $sectionoffset, 0; while(my $line = ) { last if ($line =~ /^@/); + chomp $line; if ($line =~ /^:$ding\s+(.*)$/) { - $dingsum += $1; + my $dingmod = $1; + if ($dingmod =~ /^!(.*)$/) { + $pointsset = $1; + } else { + $dingsum += $1; + } push @$dingtext, "($1)"; untilDefinesDot(sub ($) { push @$dingtext, @_; }); push @$dingtext, "";