From 7e50c40f6a6fb1b58355cec4adebb0968a3fd0bd Mon Sep 17 00:00:00 2001 From: Florian Heiderich Date: Wed, 18 Nov 2015 16:51:17 +0100 Subject: [PATCH 1/4] add maketext calls for "Solution:" --- macros/PGbasicmacros.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/PGbasicmacros.pl b/macros/PGbasicmacros.pl index 37d1f66af4..f8df2fabcc 100644 --- a/macros/PGbasicmacros.pl +++ b/macros/PGbasicmacros.pl @@ -1506,9 +1506,9 @@ sub ALPHABET { Latex2HTML => ' ', HTML => ' '); }; -sub SOLUTION_HEADING { MODES( TeX => '\\par {\\bf Solution: }', - Latex2HTML => '\\par {\\bf Solution: }', - HTML => 'Solution: '); +sub SOLUTION_HEADING { MODES( TeX => '\\par {\\bf '.maketext('Solution:').' }', + Latex2HTML => '\\par {\\bf '.maketext('Solution:').' }', + HTML => ''.maketext('Solution:').' '); }; sub HINT_HEADING { MODES( TeX => "\\par {\\bf Hint: }", Latex2HTML => "\\par {\\bf Hint: }", HTML => "Hint: "); }; sub US { MODES(TeX => '\\_', Latex2HTML => '\\_', HTML => '_');}; # underscore, e.g. file${US}name From d5996f3758b79480f4cfb478984e5fb7d1e56fc4 Mon Sep 17 00:00:00 2001 From: Florian Heiderich Date: Wed, 18 Nov 2015 17:10:46 +0100 Subject: [PATCH 2/4] add maketext call for "Instructor solution preview: show the student solution after due date." --- macros/PGbasicmacros.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/PGbasicmacros.pl b/macros/PGbasicmacros.pl index f8df2fabcc..0fb2122b12 100644 --- a/macros/PGbasicmacros.pl +++ b/macros/PGbasicmacros.pl @@ -1203,7 +1203,7 @@ sub solution { PG_restricted_eval(q!$main::solutionExists = 1!); # set solution exists variable.--don't need PGeval?? if ($printSolutionForInstructor) { # always print solutions for instructor types - $out = join(' ', $BITALIC, "(Instructor solution preview: show the student solution after due date. )$BR",$EITALIC, @in); + $out = join(' ', $BITALIC, "(", maketext("Instructor solution preview: show the student solution after due date.")," )$BR",$EITALIC, @in); } elsif ( $displaySolution ) { $out = join(' ',@in); # display solution } From ad98edde173a61f10aa70933594de8082d432569 Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Wed, 23 Nov 2016 17:21:24 -0800 Subject: [PATCH 3/4] bugfixes for niceTables.pl --- macros/niceTables.pl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/macros/niceTables.pl b/macros/niceTables.pl index 22cec05112..dea1d15c95 100644 --- a/macros/niceTables.pl +++ b/macros/niceTables.pl @@ -142,7 +142,7 @@ =head2 pccTables.pl # texpre => tex code, # For more fussy cell-by-cell alteration of the tex version of the table # # TeX code here will precede the cell entry... # texpost => tex code # and code here will follow the cell entry - # # The ordering will be: tex texpre data texpost + # # The ordering will be: texpre tex data texpost # texencase => array ref # This is just a shortcut for entering [texpre,texpost] at once. # # The "a" in a cell can also be replaced directly with a hash reference {data=>a,options} if somehow that is of use. If you @@ -364,7 +364,9 @@ sub DataTable { if ($htmlalignment[$i] =~ /\|\s*/) {my $j = $i; while (!defined($alignmentcolumns[$j]) && $j < $#htmlalignment) {$j += 1;}; if ($j < $#htmlalignment) {$columnscss->[$alignmentcolumns[$j]] = "border-left:solid 1px; ".$columnscss->[$alignmentcolumns[$j]];}; - if ($alignmentcolumns[$j] != 0) {$columnscss->[$alignmentcolumns[$j]-1] = "border-right:solid 1px; ".$columnscss->[$alignmentcolumns[$j]-1];} + if (defined $alignmentcolumns[$j]) { + if ($alignmentcolumns[$j] != 0) {$columnscss->[$alignmentcolumns[$j]-1] = "border-right:solid 1px; ".$columnscss->[$alignmentcolumns[$j]-1];} + }; if ($j == $#htmlalignment) {if ($j == $i) {$columnscss->[-1] = "border-right:solid 1px; ".$columnscss->[-1];} else {$columnscss->[-1] = "border-left:solid 1px; ".$columnscss->[-1];}} }; @@ -574,16 +576,15 @@ sub DataTable { { if ($rowcolor[$i] ne '') {$textable .= '\rowcolor'.$rowcolor[$i];}; for my $j (0..$numcols[$i]) - {if (uc(${$dataref->[$i][$j]}{header}) ~~ ['TH','CH','COLUMN','COL','RH','ROW']) {${$dataref->[$i][$j]}{tex} = '\bfseries '.${$dataref->[$i][$j]}{tex}}; + {if (uc(${$dataref->[$i][$j]}{header}) ~~ ['TH','CH','COLUMN','COL','RH','ROW'] or ($headerrow[$i] == 1) and !(uc(${$dataref->[$i][$j]}{header}) ~~ ['TD'])) {${$dataref->[$i][$j]}{tex} = '\bfseries '.${$dataref->[$i][$j]}{tex}}; if (${$dataref->[$i][$j]}{multicolumn} ne '') {$textable .= ${$dataref->[$i][$j]}{multicolumn}}; - if (($headerrow[$i] == 1) and !(uc(${$dataref->[$i][$j]}{header}) ~~ ['TD'])) {$textable .= '\bfseries '}; - $textable .= ${$dataref->[$i][$j]}{tex}.' '.${$dataref->[$i][$j]}{texpre}.' '.${$dataref->[$i][$j]}{data}.' '.${$dataref->[$i][$j]}{texpost}; + $textable .= ${$dataref->[$i][$j]}{texpre}.' '.${$dataref->[$i][$j]}{tex}.' '.${$dataref->[$i][$j]}{data}.' '.${$dataref->[$i][$j]}{texpost}; if (${$dataref->[$i][$j]}{multicolumn} ne '') {$textable .= '}'}; $textable .= '&' unless ($j == $numcols[$i]); }; $textable .= '\\\\'; if ($midrule[$i] == 1) {$textable .= '\midrule '}; - if ((($midrules == 1) or ($headerrow[$i] == 1)) and (($i != $#{$dataref}) or ($footerline ne ''))) {$textable .= '\midrule '}; + if ((($midrules == 1) or ($headerrow[$i] == 1)) and ($i != $#{$dataref})) {$textable .= '\midrule '}; }; $textable .= '\bottomrule'.$endtabular; $textable .= '\end{minipage}\par \vspace{1pc}'; From 4f7db729965b85e56dd6f44618703e29b0da1cd2 Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Wed, 23 Nov 2016 17:25:18 -0800 Subject: [PATCH 4/4] Adjustments to PGbasicmacros.pl for compatibility with MathBook XML --- macros/PGbasicmacros.pl | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/macros/PGbasicmacros.pl b/macros/PGbasicmacros.pl index 874ea5b602..a1cee513dd 100644 --- a/macros/PGbasicmacros.pl +++ b/macros/PGbasicmacros.pl @@ -1236,7 +1236,11 @@ sub SOLUTION { TEXT( $PAR, knowlLink(SOLUTION_HEADING(), value => escapeSolutionHTML($BR . solution(@_) . $PAR ), base64 =>1 ) ) if solution(@_); } elsif ($displayMode=~/TeX/) { - TEXT($PAR,SOLUTION_HEADING(), solution(@_).$PAR) if solution(@_) ; + TEXT( + "\n%%% BEGIN SOLUTION\n", #Marker used in MathBook XML extraction; contact alex.jordan@pcc.edu before modifying + $PAR,SOLUTION_HEADING(), solution(@_).$PAR, + "\n%%% END SOLUTION\n" #Marker used in MathBook XML extraction; contact alex.jordan@pcc.edu before modifying + ) if solution(@_) ; } elsif ($displayMode=~/HTML/) { TEXT( $PAR.SOLUTION_HEADING().$BR.solution(@_).$PAR) if solution(@_) ; } else { @@ -1287,7 +1291,11 @@ sub HINT { TEXT($PAR, knowlLink(HINT_HEADING(), value=>escapeSolutionHTML($BR . hint(@_) . $PAR ), base64 => 1) ) if hint(@_); } elsif ($displayMode=~/TeX/) { - TEXT($PAR,HINT_HEADING(), hint(@_).$PAR) if hint(@_) ; + TEXT( + "\n%%% BEGIN HINT\n", #Marker used in MathBook XML extraction; contact alex.jordan@pcc.edu before modifying + $PAR,HINT_HEADING(), hint(@_).$PAR, + "\n%%% END HINT\n" #Marker used in MathBook XML extraction; contact alex.jordan@pcc.edu before modifying + ) if hint(@_) ; } else { TEXT($PAR, HINT_HEADING(), $BR. hint(@_) . $PAR) if hint(@_); } @@ -2186,19 +2194,24 @@ sub beginproblem { my $print_path_name_flag = (defined($effectivePermissionLevel) && defined($PRINT_FILE_NAMES_PERMISSION_LEVEL) && $effectivePermissionLevel >= $PRINT_FILE_NAMES_PERMISSION_LEVEL) || ( defined($inlist{ $studentLogin }) and ( $inlist{ $studentLogin }>0 ) )?1:0 ; - $out .= MODES( TeX => '', HTML => '

'); + $out .= MODES( TeX => + "\n%%% BEGIN PROBLEM PREAMBLE\n", #Marker used in MathBook XML extraction; contact alex.jordan@pcc.edu before modifying + HTML => '

'); if ( $print_path_name_flag ) { $out .= &M3("{\\bf ${probNum}. {\\footnotesize ($problemValue $points) \\path|$fileName|}}\\newline ", " \\begin{rawhtml} ($problemValue $points) $l2hFileName
\\end{rawhtml}", "($problemValue $points) $fileName
" - ) if ($problemValue >=0 and ($envir->{setNumber})=~/\S/ and ($envir->{setNumber}) ne 'Undefined_Set' ); + ) if ($problemValue >=0 and ($envir->{setNumber})=~/\S/ and ($envir->{setNumber}) ne 'Undefined_Set' and ($envir->{setNumber}) ne 'not defined'); } else { $out .= &M3("{\\bf ${probNum}.} ($problemValue $points) ", "($problemValue $points) ", "($problemValue $points) " - ) if ($problemValue >= 0 and ($envir->{setNumber})=~/\S/ and ($envir->{setNumber}) ne 'Undefined_Set'); + ) if ($problemValue >= 0 and ($envir->{setNumber})=~/\S/ and ($envir->{setNumber}) ne 'Undefined_Set' and ($envir->{setNumber}) ne 'not defined'); } $out .= MODES(%{main::PG_restricted_eval(q!$main::problemPreamble!)}); + $out .= MODES( TeX => + "\n%%% END PROBLEM PREAMBLE\n", #Marker used in MathBook XML extraction; contact alex.jordan@pcc.edu before modifying + HTML => ""); $out; }