* (bug 13466) White space differences not shown in diffs
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Fri, 21 Mar 2008 11:48:24 +0000 (11:48 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Fri, 21 Mar 2008 11:48:24 +0000 (11:48 +0000)
RELEASE-NOTES
includes/DefaultSettings.php
includes/DifferenceEngine.php
skins/common/diff.css

index 99cd5e2..114326f 100644 (file)
@@ -112,7 +112,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   so groups may optionally edit protected pages without having 'protect' perms
 * Disallow deletion of big pages by means of moving a page to its title and using the
   "delete and move" option.
-
+* (bug 13466) White space differences not shown in diffs
 
 === API changes in 1.13 ===
 
index 76d492a..71c1c80 100644 (file)
@@ -1325,7 +1325,7 @@ $wgCacheEpoch = '20030516000000';
  * to ensure that client-side caches don't keep obsolete copies of global
  * styles.
  */
-$wgStyleVersion = '124';
+$wgStyleVersion = '125';
 
 
 # Server-side caching:
index 83409a6..0671fa0 100644 (file)
@@ -1773,10 +1773,10 @@ class _HWLDF_WordAccumulator {
        function _flushGroup ($new_tag) {
                if ($this->_group !== '') {
                        if ($this->_tag == 'ins')
-                               $this->_line .= '<ins class="diffchange">' .
+                               $this->_line .= '<ins class="diffchange diffchange-inline">' .
                                        htmlspecialchars ( $this->_group ) . '</ins>';
                        elseif ($this->_tag == 'del')
-                               $this->_line .= '<del class="diffchange">' .
+                               $this->_line .= '<del class="diffchange diffchange-inline">' .
                                        htmlspecialchars ( $this->_group ) . '</del>';
                        else
                                $this->_line .= htmlspecialchars ( $this->_group );
@@ -1918,6 +1918,13 @@ class TableDiffFormatter extends DiffFormatter
                $this->trailing_context_lines = 2;
        }
 
+       public static function escapeWhiteSpace( $msg ) {
+               $msg = preg_replace( '/^ /m', '&nbsp; ', $msg );
+               $msg = preg_replace( '/ $/m', ' &nbsp;', $msg );
+               $msg = preg_replace( '/  /', '&nbsp; ', $msg );
+               return $msg;
+       }
+
        function _block_header( $xbeg, $xlen, $ybeg, $ylen ) {
                $r = '<tr><td colspan="2" class="diff-lineno"><!--LINE '.$xbeg."--></td>\n" .
                  '<td colspan="2" class="diff-lineno"><!--LINE '.$ybeg."--></td></tr>\n";
@@ -1952,7 +1959,7 @@ class TableDiffFormatter extends DiffFormatter
        private function wrapLine( $marker, $class, $line ) {
                if( $line !== '' ) {
                        // The <div> wrapper is needed for 'overflow: auto' style to scroll properly
-                       $line = "<div>$line</div>";
+                       $line = Xml::tags( 'div', null, $this->escapeWhiteSpace( $line ) );
                }
                return "<td class='diff-marker'>$marker</td><td class='$class'>$line</td>";
        }
index 6a1f23b..222be7e 100644 (file)
@@ -34,6 +34,9 @@ td.diff-context {
        font-weight: bold;
        text-decoration: none;
 }
+.diffchange-inline {
+       border: 1px dotted red;
+}
 
 table.diff {
        border: none;