Having added a diff -u output in a post on moodle.org I've fallen into this issue, better described in MDLSITE-1113.
It appears the algebra filter allows a user to escape a "@@...@@" sequence by prepending an extra "@": since Unified Diff is a well-known format and users cannot edit this output before posting it in Moodle Community, the patch below will escape such sequences without the need of an extra prepended "@":
--- algebra\filter.php.orig Thu Nov 04 10:52:20 2010
|
+++ algebra\filter.php Thu Nov 04 10:51:53 2010
|
@@ -114,10 +114,18 @@
|
|
$text .= ' ';
|
|
+ // Prepending @ to a @@..@... sequence avoid any conversion
|
preg_match_all('/@(@@+)([^@])/',$text,$matches);
|
for ($i=0;$i<count($matches[0]);$i++) {
|
$replacement = str_replace('@','@',$matches[1][$i]).$matches[2][$i];
|
$text = str_replace($matches[0][$i],$replacement,$text);
|
+ }
|
+
|
+ // Escape @@...@@ occurences when representing Unified Diff change chunkes
|
+ preg_match_all('/@@ \-(\d+(,\d+)?) \+(\d+(,\d+)?) @@/',$text,$matches);
|
+ for ($i=0; $i < count($matches[0]); $i++) {
|
+ $replacement = str_replace('@', '@', $matches[0][$i]);
|
+ $text = str_replace($matches[0][$i], $replacement, $text);
|
}
|
|
// <algebra> some algebraic input expression </algebra>
|
The same applies to HEAD branch.
Matteo
- has a non-specific relationship to
-
MDL-31244 Problem with images in question bank and quiz if algebra filter is enabled
- Closed