Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions templates/ContentGenerator/Instructor/ProblemGrader.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,21 @@
: $scores[$i] ? 'color:#060' : 'color:#600' %>">
% if ($answerTypes[$i] && $answerTypes[$i] eq 'essay') {
% # If the answer is an essay answer then display it line by line.
<div class="past-answer">
<%= c(split /\n/, $answers[$i])->join('<br>') =%>
</div>
% my @lines = split /\n/, $answers[$i];
% for (0 .. $#lines - 1) {
<%= $lines[$_] =%><br>
% }
<%= $lines[-1] =%>
% } elsif ($answerTypes[$i] && $answerTypes[$i] eq 'Value (Formula)') {
% # If its a formula then mark it as tex for MathJax.
`<%= $answers[$i] %>`
</div>
% } else {
% # If it isn't an essay or a formula then show it as text.
<%= $answers[$i] %>
% my @parts = split("&#9070;", $answers[$i]);
% for (0 .. $#parts - 1) {
<%= $parts[$_] =%>&#9070;\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the backslash after the &#9070; meant to be here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the backslash is intended. That prevents a newline from being injected, and thus creating a white space node in the HTML output. Here are screenshots showing the difference (the first image is with the backslash, and the second without):

Image
Image

and here is the difference in the generated HTML (again first with the backslash, and second without):

								<td style="color:#006600" class="px-3 ">
C&#9070;D&#9070;E&#9070;F								</td>
								<td style="color:#006600" class="px-3 ">
C&#9070;
D&#9070;
E&#9070;
F								</td>

% }
<%= $parts[-1] =%>
% }
</div>
% }
Expand Down