13
13
# Artistic License for more details.
14
14
# ###############################################################################
15
15
16
- loadMacros(" MathObjects.pl" );
16
+ loadMacros(' MathObjects.pl' , ' PGbasicmacros.pl ' );
17
17
18
18
sub _parserMultiAnswer_init {
19
19
main::PG_restricted_eval(' sub MultiAnswer {parser::MultiAnswer->new(@_)}' );
@@ -175,7 +175,12 @@ sub single_check {
175
175
my $i = 0;
176
176
my $nonblank = 0;
177
177
if ($self -> perform_check($ans )) {
178
- push (@errors , ' <TR><TD STYLE="text-align:left" COLSPAN="2">' . $self -> {ans }[0]{ans_message } . ' </TD></TR>' );
178
+ push (
179
+ @errors ,
180
+ main::tag(
181
+ ' tr' , main::tag(' td' , style => ' text-align:left' , colspan => ' 2' , $self -> {ans }[0]{ans_message })
182
+ )
183
+ );
179
184
$self -> {ans }[0]{ans_message } = " " ;
180
185
}
181
186
foreach my $result (@{ $self -> {ans } }) {
@@ -185,26 +190,34 @@ sub single_check {
185
190
push (@text , check_string($result -> {preview_text_string }, ' __' ));
186
191
push (@student , check_string($result -> {student_ans }, ' __' ));
187
192
if ($result -> {ans_message }) {
188
- push (@errors ,
189
- ' <TR VALIGN="TOP"><TD STYLE="text-align:right; border:0px" NOWRAP>'
190
- . " <I>In answer $i </I>: </TD>"
191
- . ' <TD STYLE="text-align:left; border:0px">'
192
- . $result -> {ans_message }
193
- . ' </TD></TR>' );
193
+ push (
194
+ @errors ,
195
+ main::tag(
196
+ ' tr' ,
197
+ main::tag(
198
+ ' td' ,
199
+ style => ' text-align:right' ,
200
+ main::tag(' i' , " In answer $i " ) . ' : '
201
+ )
202
+ . main::tag(' td' , style => ' text-align:left' , $result -> {ans_message })
203
+ )
204
+ );
194
205
}
195
206
$score += $result -> {score };
196
207
}
197
208
$ans -> score($score / $self -> length );
198
209
$ans -> {ans_message } = $ans -> {error_message } = " " ;
199
210
if (scalar (@errors )) {
200
- $ans -> {ans_message } = $ans -> {error_message } =
201
- ' <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" CLASS="ArrayLayout">'
202
- . join (' <TR><TD HEIGHT="4"></TD></TR>' , @errors )
203
- . ' </TABLE>' ;
211
+ $ans -> {ans_message } = $ans -> {error_message } = main::tag(
212
+ ' table' ,
213
+ class => ' ArrayLayout' ,
214
+ style => ' width:100%' ,
215
+ join (main::tag(' tr' , style => ' height: 4px' , main::tag(' td' )), @errors )
216
+ );
204
217
}
205
218
if (@{ $self -> {single_ans_messages } }) {
206
219
$ans -> {ans_message } = $ans -> {error_message } =
207
- ' <DIV> ' . join ( ' </DIV><DIV> ' , @{ $self -> {single_ans_messages } }) . ' </DIV> ' . $ans -> { ans_message } ;
220
+ join ( ' ' , map { main::tag( ' div ' , $_ ) } @{ $self -> {single_ans_messages } });
208
221
}
209
222
if ($nonblank ) {
210
223
$ans -> {preview_latex_string } =
0 commit comments