Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

macros to show a text file and a problem file alongside its code #1199

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions macros/core/PGbasicmacros.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3220,6 +3220,24 @@ sub tag {
return "<$tag" . ($attributes_str ? " $attributes_str" : '') . '>' . ($SELF_CLOSING{$tag} ? '' : "$content</$tag>");
}

# Show text and problem code
# argument should be a path to a text file, relative to templates folder
sub text_file {
TEXT(
MODES(HTML => '<pre>', TeX => '\begin{verbatim}', PTX => '<pre>'),
${ read_whole_problem_file($envir{templateDirectory} . shift) },
MODES(HTML => '</pre>', TeX => '\end{verbatim}', PTX => '</pre>')
);
}

# argument should be a path to a pg file, relative to templates folder
sub problem_with_code {
my $filepath = shift;
text_file($filepath);
TEXT($HR);
includePGproblem($filepath);
}

###########
# Auxiliary macros

Expand Down