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

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

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

Revision 5792 Revision 5816
378 $col = 80 unless defined($col); 378 $col = 80 unless defined($col);
379 $name = RECORD_ANS_NAME($name); 379 $name = RECORD_ANS_NAME($name);
380 my $height = .07*$row; 380 my $height = .07*$row;
381 my $answer_value = ''; 381 my $answer_value = '';
382 $answer_value = $inputs_ref->{$name} if defined( $inputs_ref->{$name} ); 382 $answer_value = $inputs_ref->{$name} if defined( $inputs_ref->{$name} );
383 $answer_value =~ tr/\\$@`//d; #`## make sure student answers can not be interpolated by e.g. EV3 383# $answer_value =~ tr/\\$@`//d; #`## make sure student answers can not be interpolated by e.g. EV3
384 my $out = M3( 384 my $out = M3(
385 qq!\\vskip $height in \\hrulefill\\quad !, 385 qq!\\vskip $height in \\hrulefill\\quad !,
386 qq!\\begin{rawhtml}<TEXTAREA NAME="$name" ROWS="$row" COLS="$col" 386 qq!\\begin{rawhtml}<TEXTAREA NAME="$name" ROWS="$row" COLS="$col"
387 WRAP="VIRTUAL">$answer_value</TEXTAREA>\\end{rawhtml}!, 387 WRAP="VIRTUAL">$answer_value</TEXTAREA>\\end{rawhtml}!,
388 qq!<TEXTAREA NAME="$name" ROWS="$row" COLS="$col" 388 qq!<TEXTAREA NAME="$name" ROWS="$row" COLS="$col"
1228############################################################### 1228###############################################################
1229# Some constants which are different in tex and in HTML 1229# Some constants which are different in tex and in HTML
1230# The order of arguments is TeX, Latex2HTML, HTML 1230# The order of arguments is TeX, Latex2HTML, HTML
1231# Adopted Davide Cervone's improvements to PAR, LTS, GTS, LTE, GTE, LBRACE, RBRACE, LB, RB. 7-14-03 AKP 1231# Adopted Davide Cervone's improvements to PAR, LTS, GTS, LTE, GTE, LBRACE, RBRACE, LB, RB. 7-14-03 AKP
1232sub PAR { MODES( TeX => '\\par ', Latex2HTML => '\\begin{rawhtml}<P>\\end{rawhtml}', HTML => '<P>'); }; 1232sub PAR { MODES( TeX => '\\par ', Latex2HTML => '\\begin{rawhtml}<P>\\end{rawhtml}', HTML => '<P>'); };
1233sub BR { MODES( TeX => '\\par\\noindent ', Latex2HTML => '\\begin{rawhtml}<BR>\\end{rawhtml}', HTML => '<BR>'); }; 1233#sub BR { MODES( TeX => '\\par\\noindent ', Latex2HTML => '\\begin{rawhtml}<BR>\\end{rawhtml}', HTML => '<BR>'); };
1234# Alternate definition of BR which is slightly more flexible and gives more white space in printed output 1234# Alternate definition of BR which is slightly more flexible and gives more white space in printed output
1235# which looks better but kills more trees. 1235# which looks better but kills more trees.
1236#sub BR { MODES( TeX => '\\leavevmode\\\\', Latex2HTML => '\\begin{rawhtml}<BR>\\end{rawhtml}', HTML => '<BR>'); }; 1236sub BR { MODES( TeX => '\\leavevmode\\\\\\relax ', Latex2HTML => '\\begin{rawhtml}<BR>\\end{rawhtml}', HTML => '<BR>'); };
1237sub LQ { MODES( TeX => "``", Latex2HTML => '"', HTML => '&quot;' ); }; 1237sub LQ { MODES( TeX => "``", Latex2HTML => '"', HTML => '&quot;' ); };
1238sub RQ { MODES( TeX => "''", Latex2HTML => '"', HTML => '&quot;' ); }; 1238sub RQ { MODES( TeX => "''", Latex2HTML => '"', HTML => '&quot;' ); };
1239sub BM { MODES(TeX => '\\(', Latex2HTML => '\\(', HTML => ''); }; # begin math mode 1239sub BM { MODES(TeX => '\\(', Latex2HTML => '\\(', HTML => ''); }; # begin math mode
1240sub EM { MODES(TeX => '\\)', Latex2HTML => '\\)', HTML => ''); }; # end math mode 1240sub EM { MODES(TeX => '\\)', Latex2HTML => '\\)', HTML => ''); }; # end math mode
1241sub BDM { MODES(TeX => '\\[', Latex2HTML => '\\[', HTML => '<P ALIGN=CENTER>'); }; #begin displayMath mode 1241sub BDM { MODES(TeX => '\\[', Latex2HTML => '\\[', HTML => '<P ALIGN=CENTER>'); }; #begin displayMath mode
1675 ); 1675 );
1676 my $string = join(" ",@_); 1676 my $string = join(" ",@_);
1677 $string = ev_substring($string,"\\\\{","\\\\}",\&safe_ev) if $options{processCommands}; 1677 $string = ev_substring($string,"\\\\{","\\\\}",\&safe_ev) if $options{processCommands};
1678 if ($options{processVariables}) { 1678 if ($options{processVariables}) {
1679 my $eval_string = $string; 1679 my $eval_string = $string;
1680 $eval_string =~ s/\$(?![a-z])/\${DOLLAR}/gi if $options{fixDollars}; 1680 $eval_string =~ s/\$(?![a-z\{])/\${DOLLAR}/gi if $options{fixDollars};
1681 my ($evaluated_string,$PG_eval_errors,$PG_full_errors) = 1681 my ($evaluated_string,$PG_eval_errors,$PG_full_errors) =
1682 PG_restricted_eval("<<END_OF_EVALUATION_STRING\n$eval_string\nEND_OF_EVALUATION_STRING\n"); 1682 PG_restricted_eval("<<END_OF_EVALUATION_STRING\n$eval_string\nEND_OF_EVALUATION_STRING\n");
1683 if ($PG_eval_errors) { 1683 if ($PG_eval_errors) {
1684 my $error = (split("\n",$PG_eval_errors))[0]; $error =~ s/at \(eval.*//gs; 1684 my $error = (split("\n",$PG_eval_errors))[0]; $error =~ s/at \(eval.*//gs;
1685 $string =~ s/&/&amp;/g; $string =~ s/</&lt;/g; $string =~ s/>/&gt;/g; 1685 $string =~ s/&/&amp;/g; $string =~ s/</&lt;/g; $string =~ s/>/&gt;/g;
1789 my $points ='pts'; 1789 my $points ='pts';
1790 1790
1791 $points = 'pt' if $problemValue == 1; 1791 $points = 'pt' if $problemValue == 1;
1792 ## Prepare header for the problem 1792 ## Prepare header for the problem
1793 grep($inlist{$_}++,@{ $envir->{'PRINT_FILE_NAMES_FOR'} }); 1793 grep($inlist{$_}++,@{ $envir->{'PRINT_FILE_NAMES_FOR'} });
1794 my $permissionLevel = $envir->{permissionLevel};
1795 my $PRINT_FILE_NAMES_PERMISSION_LEVEL = $envir->{'PRINT_FILE_NAMES_PERMISSION_LEVEL'};
1796 my $studentLogin = $envir->{studentLogin};
1797 my $print_path_name_flag =
1798 (defined($permissionLevel) && defined($PRINT_FILE_NAMES_PERMISSION_LEVEL) && $permissionLevel >= $PRINT_FILE_NAMES_PERMISSION_LEVEL)
1794 if ( defined($inlist{$envir->{studentLogin}}) and ($inlist{$envir->{studentLogin}} > 0) ) { 1799 || ( defined($inlist{ $studentLogin }) and ( $inlist{ $studentLogin }>0 ) ) ;
1800
1801 if ( $print_path_name_flag ) {
1795 $out = &M3("{\\bf ${probNum}. {\\footnotesize ($problemValue $points) $TeXFileName}}\\newline ", 1802 $out = &M3("{\\bf ${probNum}. {\\footnotesize ($problemValue $points) $TeXFileName}}\\newline ",
1796 " \\begin{rawhtml} ($problemValue $points) <B>$l2hFileName</B><BR>\\end{rawhtml}", 1803 " \\begin{rawhtml} ($problemValue $points) <B>$l2hFileName</B><BR>\\end{rawhtml}",
1797 "($problemValue $points) <B>$fileName</B><BR>" 1804 "($problemValue $points) <B>$fileName</B><BR>"
1798 ) if ($problemValue ne ""); 1805 ) if ($problemValue ne "");
1799 } else { 1806 } else {

Legend:
Removed from v.5792  
changed lines
  Added in v.5816

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9