41 self::SIDE_DELETED =>
'diff-side-deleted',
42 self::SIDE_ADDED =>
'diff-side-added'
46 $this->leadingContextLines = 2;
47 $this->trailingContextLines = 2;
56 $msg = preg_replace(
'/^ /m',
"\u{00A0} ", $msg );
57 $msg = preg_replace(
'/ $/m',
" \u{00A0}", $msg );
58 $msg = preg_replace(
'/ /',
"\u{00A0} ", $msg );
71 protected function blockHeader( $xbeg, $xlen, $ybeg, $ylen ) {
74 return Html::rawElement(
79 [
'colspan' =>
'2',
'class' =>
'diff-lineno',
'id' =>
'mw-diff-left-l' . $xbeg ],
80 '<!--LINE ' . $xbeg .
'-->'
85 [
'colspan' =>
'2',
'class' =>
'diff-lineno' ],
86 '<!--LINE ' . $ybeg .
'-->'
105 protected function lines(
$lines, $prefix =
' ', $color =
'white' ) {
150 if (
$line !==
'' ) {
154 $line = Html::element(
'br' );
157 $markerAttrs = [
'class' =>
'diff-marker' ];
159 $markerAttrs[
'data-marker'] = $marker;
162 return Html::element(
'td', $markerAttrs ) .
163 Html::rawElement(
'td', [
'class' => $class ],
$line );
171 return Html::element(
'td', [
'colspan' =>
'2',
'class' => $this->
getClassForSide( $side ) ] );
189 [
'class' =>
'diffchange' ],
213 [
'class' =>
'diffchange' ],
249 protected function changed( $orig, $closing ) {
251 $del = $diff->orig();
252 $add = $diff->closing();
254 # Notice that WordLevelDiff returns HTML-escaped output.
255 # Hence, we will be calling addedLine/deletedLine without HTML-escaping.
257 $ndel = count( $del );
258 $nadd = count( $add );
259 $n = max( $ndel, $nadd );
260 for ( $i = 0; $i < $n; $i++ ) {
261 $delLine = $i < $ndel ? $this->
deletedLine( $del[$i] ) : $this->
emptyLine( self::SIDE_DELETED );
262 $addLine = $i < $nadd ? $this->
addedLine( $add[$i] ) : $this->
emptyLine( self::SIDE_ADDED );
283 throw new InvalidArgumentException(
"Invalid diff side: $side" );
285 return self::SIDE_CLASSES[$side];
if(ini_get('mbstring.func_overload')) if(!defined('MW_ENTRY_POINT'))
Pre-config setup: Before loading LocalSettings.php.
Performs a word-level diff on several lines.
if(!file_exists( $CREDITS)) $lines