WeBWorK::PG::ConvertToPGML - convert a file in original PG format to PGML
Converts a pg file to PGML format.
This script does a number of conversions:
Update the loadMacros call to include PGML.pl, eliminate MathObjects.pl and niceTables.pl (since they are loaded by PGML.pl) and adds PGcourse.pl to the end of the list.
Coverts BEGIN_TEXT/END_TEXT, BEGIN_SOLUTION/END_SOLUTION, BEGIN_HINT/END_HINT, and the older TEXT(EV2(<<TERM));/SOLUTION(EV3(<<TERM));/HINT(EV2(<<TERM)); heredoc forms (with TERM being any terminator the problem author chose) to their newer BEGIN_PGML blocks.
Convert math mode in these blocks to PGML style math mode.
Convert other styling (bold, italics) to PGML style.
Convert variables to the interpolated [$var] PGML style.
Leave answer rules and answer evaluators as they were, as ordinary Perl code inside a [@ @] block. Pairing them up and converting them to PGML answer blanks is left entirely to manual review.
Remove some outdated code.
A few other minor things.
This subroutine converts the file that is passed in as a multi-line string and assumed to be an older-style PG file with BEGIN_TEXT/END_TEXT, BEGIN_SOLUTION/END_SOLUTION, and BEGIN_HINT/END_HINT blocks.
The input is expected to be a string containing the source of the pg file to be converted. This returns a string that is the converted input string.