version 1.88, 2004/10/05 20:18:29
|
version 1.90, 2004/10/11 16:31:34
|
Line 70 sub caparesponse_check {
|
Line 70 sub caparesponse_check {
|
$response=~s/ +/ /g; |
$response=~s/ +/ /g; |
} |
} |
if ($type eq 'float') { $response=~s/,//g; } |
if ($type eq 'float') { $response=~s/,//g; } |
&LONCAPA_INTERNAL_DEBUG("fmt $ans_fmt, res is $response"); |
|
if ($type eq 'float' && $ans_fmt=~/\$/) { |
if ($type eq 'float' && $ans_fmt=~/\$/) { |
if ($response!~/^\$/) { return "NO_UNIT: Missing \$ "; } |
if ($response!~/^\$/) { return "NO_UNIT: Missing \$ "; } |
$response=~s/\$//g; |
$response=~s/\$//g; |
Line 515 sub chemparse {
|
Line 514 sub chemparse {
|
} |
} |
next; |
next; |
} |
} |
$token =~ /^\s*(\d*)(.*)/; |
$token =~ /^\s*(\d*(?:&frac\d\d)?)(.*)/; |
$formula .= $1 if ($1 > 1); # stoichiometric coefficient |
$formula .= $1 if ($1 ne '1'); # stoichiometric coefficient |
|
|
my $molecule = $2; |
my $molecule = $2; |
# subscripts |
# subscripts |
Line 537 sub chemparse {
|
Line 536 sub chemparse {
|
|
|
sub prettyprint { |
sub prettyprint { |
my ($value,$fmt,$target)=@_; |
my ($value,$fmt,$target)=@_; |
&LONCAPA_INTERNAL_DEBUG("format -$fmt-"); |
|
my $result; |
my $result; |
if (!$target) { $target = $external::target; } |
if (!$target) { $target = $external::target; } |
if ($fmt =~ /chem/i) { return(&chemparse($value)); } |
if ($fmt =~ /chem/i) { return(&chemparse($value)); } |