WeBWorK Problems

Custom Answer Checker

Re: Custom Answer Checker

by Davide Cervone -
Number of replies: 0
Yes, CVS is pretty cool.

As for the other labels, you can do that now. There are only two places where the Ordering context assumes the values are single letters. The first is when you specify the order by a string passed to Ordering() and I have updated the contextOrdering.pl file to allow multi-letter labels; use CVS to get the latest copy.

The other is in the error messages, which all refer to "letters". You could either make a local copy of contextOrdering.pl and edit the error messages in it (not recommended), or make a separate macro file (say Ordering.pl without the "context" prefix) that contains the following:

    loadMacros("contextOrdering.pl");
    sub _Ordering_init {
      $context{Ordering} = Parser::Context->getCopy("Ordering") unless defined $context{Ordering};
      my $context = $context{Ordering};
      $context->{error}{msg}{"Missing operand before '%s'"} = "Missing label before '%s'";
      $context->{error}{msg}{"Missing operand after '%s'"} = "Missing label after '%s'";
      $context->{error}{msg}{"Operands of %s must be letters"} = "Operatands of %s must be labels";
      $context->{error}{msg}{"Each letter may appear only once in an ordering"} =
        "Each label may appear only once in an ordering";
      $context->{error}{msg}{"Your ordering should include all the letters"} =
        "Your ordering should include all the labels";
    }

    1;
and load that macro file instead of contextOrdering.pl. This will replace the error messages that refer to "letters" with ones that refer to "labels" instead. Use whatever word best represents your situation.

Note that if you change the name of the file you will also need to change the name of the _init routine to correspond to the new name.

Hope that gets you what you need.

Davide

PS, I would start a new thread for follow-ups. This one has gotten pretty long and complicated.