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 MathObject.pl
(since it is loaded by PGML.pl
) and adds PGcourse.pl
to the end of the list.
Coverts BEGIN_TEXT
/END_TEXT
(and older versions of this), BEGIN_SOLUTION
/END_SOLUTION
, BEGIN_HINT
/END_HINT
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.
Convert some of the answer rules to newer PGML style.
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.