-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create a pg to pgml convert script #882
Conversation
84e84e5
to
b31394f
Compare
This is ready for testing. I've made the script more robust and improved documentation. If there are other features/conversions requested, happy to take those. |
c2b213f
to
0b26f5f
Compare
0b26f5f
to
11d256a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a start, but there seem to be several things that aren't working very well.
I started with Library/UMN/calculusStewartCCC/s_2_3_12.pg
and got (I also manually deleted the comment lines):
DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl', , 'PGcourse.pl');
Context("Numeric");
$a = list_random(-3,-2,-1,1,5);
$ans = Compute("(2*($a)^2+(4*$a)-5)/(($a)^2-(5*$a)+6)")->reduce;
BEGIN_PGML
Evaluate the limit, if it exists. If a limit [$BITALIC] does not exist, [$EITALIC] type "DNE".
[``
\lim_{x \to [$a]} \frac{2x^2+4x-5}{x^2-5x+6}
``]
---
Limit: [_]{}{20}
END_PGML
# ANS( $ans->cmp );
ENDDOCUMENT();
Observe the following:
- There are now two consecutive commas in the
loadMacros
call. - The
$BITALIC
and$EITALIC
did not get converted. - There is whitespace added at the end of the
Limit: [_]{}{20}
line. - The
[``\lim ... ``]
was initially in display style math mode with\[ ... \]
, but was converted to inline display style math mode. To get the same math mode it should be converted to use the three backtick version[```\lim ... ```]
.
Note that if you run the scrip on this file again, the two consecutive commas in the loadMacros
call are turned into , '',
. That is the empty string is added in between those two commas. This causes an error if the problem file is used (assuming you fix the answer).
Also, could you make the comments in the added files consistent. Some comments are capitalized and properly punctuated, but others are not.
11d256a
to
4201a36
Compare
This is added because there is a I think original Fixed these errors and added the removal of any lines with only comments on them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Starting to look closely at this. There is a lot of clean up needed in this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will need some more tweaking, but this is a start.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either the things commented on need to be fixed, or the help comments shown in the webwork2 problem editor for this need to be made much more far reaching. Clearly not only answer rules are not dealt with correctly.
152bfbb
to
42131e6
Compare
42131e6
to
98673d0
Compare
98673d0
to
db3689a
Compare
update update
improved ans_rule parsing, add $HR conversion, comment out ANS
improve the handling of the loadMacros block as well.
and added the removal of lines with only comments on them.
Also, add additional conversion functionality.
* convert AnswerFormatHelp to helpLink * remove AnswerFormatHelp from macro list * better handling of HR * better handling of code blocks inside of PGML. * when wrapping variables in [], handle arrays, hashes better.
db3689a
to
6cb3ed4
Compare
This is a script to convert a PG problem to PGML format. Details are in the script file. Overall, to run this, it is
converts each of the files to PGML format and creates a
.bak
file.