Skip to content

Commit a2131a3

Browse files
committed
Remove leftover parseSourceDiff from ace editor
1 parent 270da02 commit a2131a3

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
@@ -912,31 +912,6 @@ public function codeEditor(
912912
sprintf($editor, $code, $editable ? 'false' : 'true', $mode, $extraForEdit));
913913
}
914914

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

0 commit comments

Comments
 (0)