Skip to content

Commit 43ecaaa

Browse files
committed
Remove leftover parseSourceDiff from ace editor
1 parent 2a0de41 commit 43ecaaa

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

webapp/src/Twig/TwigExtension.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -917,31 +917,6 @@ public function codeEditor(
917917
sprintf($editor, $code, $editable ? 'false' : 'true', $mode, $extraForEdit));
918918
}
919919

920-
// This function expects $difftext to be in unified diff format. In
921-
// particular each line is expected to contain at least some character
922-
// (that is, a leading space, + or -) so that strtok does not gobble up
923-
// multiple empty lines in one go.
924-
protected function parseSourceDiff(string $difftext): string
925-
{
926-
$line = strtok($difftext, "\n"); // first line
927-
$return = '';
928-
while ($line !== false) {
929-
// Strip any additional DOS/MAC newline characters:
930-
$line = str_replace("\r", "", $line);
931-
$formdiffline = match (substr($line, 0, 1)) {
932-
'-' => "<span class='diff-del'>" . htmlspecialchars($line) . "</span>",
933-
'+' => "<span class='diff-add'>" . htmlspecialchars($line) . "</span>",
934-
default => htmlspecialchars($line),
935-
};
936-
if (str_contains($formdiffline, '#Warning: Strings contain different line endings')) {
937-
$formdiffline = "<span class='diff-endline'>$formdiffline</span>";
938-
}
939-
$return .= $formdiffline . "\n";
940-
$line = strtok("\n");
941-
}
942-
return $return;
943-
}
944-
945920
public function showDiff(string $id, SubmissionFile $newFile, SubmissionFile $oldFile): string
946921
{
947922
$editor = <<<HTML

0 commit comments

Comments
 (0)