Skip to content

Commit 47583ef

Browse files
authored
Merge pull request #288 from Alex-Jordan/MBX-mods-to-PGbasicmacros
Adjustments to PGbasicmacros.pl for compatibility with MathBook XML
2 parents 8982a83 + 4f7db72 commit 47583ef

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

macros/PGbasicmacros.pl

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,11 @@ sub SOLUTION {
12361236
TEXT( $PAR, knowlLink(SOLUTION_HEADING(), value => escapeSolutionHTML($BR . solution(@_) . $PAR ),
12371237
base64 =>1 ) ) if solution(@_);
12381238
} elsif ($displayMode=~/TeX/) {
1239-
TEXT($PAR,SOLUTION_HEADING(), solution(@_).$PAR) if solution(@_) ;
1239+
TEXT(
1240+
"\n%%% BEGIN SOLUTION\n", #Marker used in MathBook XML extraction; contact alex.[email protected] before modifying
1241+
$PAR,SOLUTION_HEADING(), solution(@_).$PAR,
1242+
"\n%%% END SOLUTION\n" #Marker used in MathBook XML extraction; contact [email protected] before modifying
1243+
) if solution(@_) ;
12401244
} elsif ($displayMode=~/HTML/) {
12411245
TEXT( $PAR.SOLUTION_HEADING().$BR.solution(@_).$PAR) if solution(@_) ;
12421246
} else {
@@ -1287,7 +1291,11 @@ sub HINT {
12871291
TEXT($PAR, knowlLink(HINT_HEADING(), value=>escapeSolutionHTML($BR . hint(@_) . $PAR ),
12881292
base64 => 1) ) if hint(@_);
12891293
} elsif ($displayMode=~/TeX/) {
1290-
TEXT($PAR,HINT_HEADING(), hint(@_).$PAR) if hint(@_) ;
1294+
TEXT(
1295+
"\n%%% BEGIN HINT\n", #Marker used in MathBook XML extraction; contact alex.[email protected] before modifying
1296+
$PAR,HINT_HEADING(), hint(@_).$PAR,
1297+
"\n%%% END HINT\n" #Marker used in MathBook XML extraction; contact [email protected] before modifying
1298+
) if hint(@_) ;
12911299
} else {
12921300
TEXT($PAR, HINT_HEADING(), $BR. hint(@_) . $PAR) if hint(@_);
12931301
}
@@ -2186,19 +2194,24 @@ sub beginproblem {
21862194
my $print_path_name_flag =
21872195
(defined($effectivePermissionLevel) && defined($PRINT_FILE_NAMES_PERMISSION_LEVEL) && $effectivePermissionLevel >= $PRINT_FILE_NAMES_PERMISSION_LEVEL)
21882196
|| ( defined($inlist{ $studentLogin }) and ( $inlist{ $studentLogin }>0 ) )?1:0 ;
2189-
$out .= MODES( TeX => '', HTML => '<P style="margin: 0">');
2197+
$out .= MODES( TeX =>
2198+
"\n%%% BEGIN PROBLEM PREAMBLE\n", #Marker used in MathBook XML extraction; contact [email protected] before modifying
2199+
HTML => '<P style="margin: 0">');
21902200
if ( $print_path_name_flag ) {
21912201
$out .= &M3("{\\bf ${probNum}. {\\footnotesize ($problemValue $points) \\path|$fileName|}}\\newline ",
21922202
" \\begin{rawhtml} ($problemValue $points) <B>$l2hFileName</B><BR>\\end{rawhtml}",
21932203
"($problemValue $points) <B>$fileName</B><BR>"
2194-
) if ($problemValue >=0 and ($envir->{setNumber})=~/\S/ and ($envir->{setNumber}) ne 'Undefined_Set' );
2204+
) if ($problemValue >=0 and ($envir->{setNumber})=~/\S/ and ($envir->{setNumber}) ne 'Undefined_Set' and ($envir->{setNumber}) ne 'not defined');
21952205
} else {
21962206
$out .= &M3("{\\bf ${probNum}.} ($problemValue $points) ",
21972207
"($problemValue $points) ",
21982208
"($problemValue $points) "
2199-
) if ($problemValue >= 0 and ($envir->{setNumber})=~/\S/ and ($envir->{setNumber}) ne 'Undefined_Set');
2209+
) if ($problemValue >= 0 and ($envir->{setNumber})=~/\S/ and ($envir->{setNumber}) ne 'Undefined_Set' and ($envir->{setNumber}) ne 'not defined');
22002210
}
22012211
$out .= MODES(%{main::PG_restricted_eval(q!$main::problemPreamble!)});
2212+
$out .= MODES( TeX =>
2213+
"\n%%% END PROBLEM PREAMBLE\n", #Marker used in MathBook XML extraction; contact [email protected] before modifying
2214+
HTML => "");
22022215
$out;
22032216

22042217
}

0 commit comments

Comments
 (0)