From 79d45992fbf9d9c97986fe680ce2b80323fc3487 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Fri, 21 Mar 2008 11:48:24 +0000 Subject: [PATCH] * (bug 13466) White space differences not shown in diffs --- RELEASE-NOTES | 2 +- includes/DefaultSettings.php | 2 +- includes/DifferenceEngine.php | 13 ++++++++++--- skins/common/diff.css | 3 +++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 99cd5e2210..114326f418 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 76d492aab8..71c1c8028d 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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: diff --git a/includes/DifferenceEngine.php b/includes/DifferenceEngine.php index 83409a60fa..0671fa0057 100644 --- a/includes/DifferenceEngine.php +++ b/includes/DifferenceEngine.php @@ -1773,10 +1773,10 @@ class _HWLDF_WordAccumulator { function _flushGroup ($new_tag) { if ($this->_group !== '') { if ($this->_tag == 'ins') - $this->_line .= '' . + $this->_line .= '' . htmlspecialchars ( $this->_group ) . ''; elseif ($this->_tag == 'del') - $this->_line .= '' . + $this->_line .= '' . htmlspecialchars ( $this->_group ) . ''; 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', '  ', $msg ); + $msg = preg_replace( '/ $/m', '  ', $msg ); + $msg = preg_replace( '/ /', '  ', $msg ); + return $msg; + } + function _block_header( $xbeg, $xlen, $ybeg, $ylen ) { $r = '\n" . '\n"; @@ -1952,7 +1959,7 @@ class TableDiffFormatter extends DiffFormatter private function wrapLine( $marker, $class, $line ) { if( $line !== '' ) { // The
wrapper is needed for 'overflow: auto' style to scroll properly - $line = "
$line
"; + $line = Xml::tags( 'div', null, $this->escapeWhiteSpace( $line ) ); } return "$marker$line"; } diff --git a/skins/common/diff.css b/skins/common/diff.css index 6a1f23b5d5..222be7e278 100644 --- a/skins/common/diff.css +++ b/skins/common/diff.css @@ -34,6 +34,9 @@ td.diff-context { font-weight: bold; text-decoration: none; } +.diffchange-inline { + border: 1px dotted red; +} table.diff { border: none; -- 2.20.1