diff --git a/webapp/src/Twig/TwigExtension.php b/webapp/src/Twig/TwigExtension.php index aed9adf2ae..acbd480e13 100644 --- a/webapp/src/Twig/TwigExtension.php +++ b/webapp/src/Twig/TwigExtension.php @@ -912,31 +912,6 @@ public function codeEditor( sprintf($editor, $code, $editable ? 'false' : 'true', $mode, $extraForEdit)); } - // This function expects $difftext to be in unified diff format. In - // particular each line is expected to contain at least some character - // (that is, a leading space, + or -) so that strtok does not gobble up - // multiple empty lines in one go. - protected function parseSourceDiff(string $difftext): string - { - $line = strtok($difftext, "\n"); // first line - $return = ''; - while ($line !== false) { - // Strip any additional DOS/MAC newline characters: - $line = str_replace("\r", "↵", $line); - $formdiffline = match (substr($line, 0, 1)) { - '-' => "" . htmlspecialchars($line) . "", - '+' => "" . htmlspecialchars($line) . "", - default => htmlspecialchars($line), - }; - if (str_contains($formdiffline, '#Warning: Strings contain different line endings')) { - $formdiffline = "$formdiffline"; - } - $return .= $formdiffline . "\n"; - $line = strtok("\n"); - } - return $return; - } - public function showDiff(string $id, SubmissionFile $newFile, SubmissionFile $oldFile): string { $editor = <<