Fix feedback previews when the display mode is "images". #1323
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 if the display mode is "images", then the student and correct answer previews don't work. The images are never actually rendered, thus the image files are never created, and so the
alt
value is shown which is the original TeX for the answer. The reason for this is that the image generator runs before the post content processor runs. So equation images in the problem are rendered, but not those in the feedback. That was done because of the hack of inserting the stringMaRkEr
followed by the image number hash when the image is initially inserted into the problem text, and then later replacing that with the alignment styel when the image is rendered. That results in invalid HTML whichMojo::DOM
doesn't like.To fix the issue the
MaRkEr
hack is reworked. Instead of that string, adata-imagegen-alignment-marker
attribute is used whose value is the image number hash. Since that is valid HTML,Mojo::DOM
is fine with it and leaves it as it is. So the image generator can now be run after the post content processor runs, and that renders the images in feedback as well.Care is needed for the images in feedback when the
data-imagegen-alignment-marker
is replaced. Since the renderedimg
tag is inside thedata-bs-content
attribute of the feedback button, it is HTML encoded. So instead of double quotes, the HTML double quote escape character (") is used.Another option would be to eliminate the "images" display mode. Clearly no one is using it, since I think this bug would have been noticed rather quickly when WeBWorK and PG 2.19 were released if anyone was using it.