Clean up the pretty_print method in PGUtil.pm #921
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently there are some issues with the method. Undefined variables used in strings cause warnings, and a string containing the word "hash" can cause errors. Furthermore, the formatting of the output is quite bad and uses invalid html (for its HTML display mode).
Also make it possible to override all of the arguments for the
PGUtil.pm
pretty_print
method when calling thePG.pl
pretty_print method. Thus you can callpretty_print(output, 'text', 10)
instead of$PG->pretty_print(output, 'text', 10)
for this anymore. This is useful in debugging when you want to see deeper into a MathObject object. The method still works the same when the additional arguments aren't passed.I debated on rearranging the last two arguments, but left them for now. The level is the argument that you would typically want to change. It is less likely that you would want to change the display mode.
Attached is a problem to test this. This problem does not work for hardcopy on the develop branch, but does with this pull request. It looks much better in html with this pull request than without.
pretty-print.pg.txt
You can also test this with an admin user in webwork2 using the various checkboxes like "Answer Group Info" and such.