Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-7541 Fixed wiki html diff

  • Loading branch information...
commit c6982f0c263358a633c1843528fed93b8ccec3ad 1 parent 0989530
sam_marshall authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 mod/wiki/ewiki/plugins/moodle/diff.php
View
13 mod/wiki/ewiki/plugins/moodle/diff.php
@@ -46,15 +46,16 @@ function ewiki_page_stupid_diff($id, $data, $action) {
$content0 = preg_replace('/(\S)\s+(\S)/', '$1 $2', $content0); // Remove multiple spaces.
$content = preg_replace('/\n|\r/i', ' ', $content);
$content = preg_replace('/(\S)\s+(\S)/', '$1 $2', $content);
-
+
/// Replace <p>&nbsp;</p>
- $content0 = preg_replace('#(<p.*>(&nbsp;|\s+)</p>|<p.*></p>)#i', "\n", $content0);
- $content = preg_replace('#(<p.*>(&nbsp;|\s+)</p>|<p.*></p>)#i', "\n", $content);
+ $content0 = preg_replace('#(<p( [^>]*)?>(&nbsp;|\s+)</p>)|(<p( [^>]*)?></p>)#i', "\n", $content0);
+ $content = preg_replace('#(<p( [^>]*)?>(&nbsp;|\s+)</p>)|(<p( [^>]*)?></p>)#i', "\n", $content);
+
/// Place new line characters at logical HTML positions.
- $htmlendings = array('+(<br.*>)+iU', '+(<p.*>)+iU', '+(</p>)+i', '+(<hr.*>)+iU', '+(<ol.*>)+iU',
- '+(</ol>)+i', '+(<ul.*>)+iU', '+(</ul>)+i', '+(<li.*>)+iU', '+(</li>)+i',
- '+(</tr>)+i', '+(<div.*>)+iU', '+(</div>)+i');
+ $htmlendings = array('+(<br.*?>)+iU', '+(<p( [^>]*)?>)+iU', '+(</p>)+i', '+(<hr.*?>)+iU', '+(<ol.*?>)+iU',
+ '+(</ol>)+i', '+(<ul.*?>)+iU', '+(</ul>)+i', '+(<li.*?>)+iU', '+(</li>)+i',
+ '+(</tr>)+i', '+(<div.*?>)+iU', '+(</div>)+i');
$htmlrepl = array("\n\$1\n", "\n\$1\n", "\n\$1\n", "\n\$1\n", "\n\$1\n",
"\n\$1\n", "\n\$1\n", "\n\$1\n", "\n\$1\n", "\n\$1\n",
"\n\$1\n", "\n\$1\n", "\n\$1\n");

0 comments on commit c6982f0

Please sign in to comment.
Something went wrong with that request. Please try again.