Skip to content

Commit

Permalink
MDL-7541 Fixed wiki html diff
Browse files Browse the repository at this point in the history
  • Loading branch information
sam_marshall committed Jun 8, 2007
1 parent 0989530 commit c6982f0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions mod/wiki/ewiki/plugins/moodle/diff.php
Expand Up @@ -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");
Expand Down

0 comments on commit c6982f0

Please sign in to comment.