[system] / trunk / pg / macros / contextString.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/contextString.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 5372 Revision 5373
2 2
3sub _contextString_init {}; # don't load it again 3sub _contextString_init {}; # don't load it again
4 4
5=head3 Context("String") 5=head3 Context("String")
6 6
7########################################################## 7 ##########################################################
8# 8 #
9# Implements contexts for string-valued answers. 9 # Implements contexts for string-valued answers.
10# 10 #
11# You can add new strings to the context as needed 11 # You can add new strings to the context as needed
12# via the Context()->strings->add() method. E.g., 12 # via the Context()->strings->add() method. E.g.,
13# 13 #
14# Context("String")->strings->add(Foo=>{}, Bar=>{alias=>"Foo"}); 14 # Context("String")->strings->add(Foo=>{}, Bar=>{alias=>"Foo"});
15# 15 #
16# Use string_cmp() to produce the answer checker(s) for your 16 # Use string_cmp() to produce the answer checker(s) for your
17# correct values. Eg. 17 # correct values. Eg.
18# 18 #
19# ANS(string_cmp("Foo")); 19 # ANS(string_cmp("Foo"));
20# 20 #
21#
22 21
23=cut 22=cut
24 23
25package contextString::Variable; 24package contextString::Variable;
26 25
64 $strings = [$strings,@_] if (scalar(@_)); 63 $strings = [$strings,@_] if (scalar(@_));
65 $strings = [$strings] unless ref($strings) eq 'ARRAY'; 64 $strings = [$strings] unless ref($strings) eq 'ARRAY';
66 return map {String($_)->cmp(showHints=>0,showLengthHints=>0)} @{$strings}; 65 return map {String($_)->cmp(showHints=>0,showLengthHints=>0)} @{$strings};
67} 66}
68 67
681;
69

Legend:
Removed from v.5372  
changed lines
  Added in v.5373

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9