MediaWiki master
Wikimedia\Diff\TableDiffFormatter Class Reference

MediaWiki default table style diff formatter. More...

Inherits Wikimedia\Diff\DiffFormatter.

Collaboration diagram for Wikimedia\Diff\TableDiffFormatter:

Public Member Functions

 __construct ()
 
- Public Member Functions inherited from Wikimedia\Diff\DiffFormatter
 format ( $diff)
 Format a diff.
 

Static Public Member Functions

static escapeWhiteSpace ( $msg)
 

Protected Member Functions

 added ( $lines)
 Writes all lines to the output buffer, each enclosed in .
 
 addedLine ( $line)
 HTML-escape parameter before calling this.
 
 blockHeader ( $xbeg, $xlen, $ybeg, $ylen)
 
 changed ( $orig, $closing)
 Writes the two sets of lines to the output buffer, each enclosed in .
 
 context ( $lines)
 Writes all lines to the output buffer, each enclosed in .
 
 contextLine ( $line, string $side)
 HTML-escape parameter before calling this.
 
 deleted ( $lines)
 Writes all lines to the output buffer, each enclosed in .
 
 deletedLine ( $line)
 HTML-escape parameter before calling this.
 
 emptyLine (string $side)
 
 endBlock ()
 Called at the end of a block of connected edits.This default implementation does nothing.
 
 lines ( $lines, $prefix=' ', $color='white')
 
 startBlock ( $header)
 Called at the start of a block of connected edits.This default implementation writes the header and a newline to the output buffer.
Parameters
string$header

 
 wrapLine ( $marker, $class, $line)
 
- Protected Member Functions inherited from Wikimedia\Diff\DiffFormatter
 block ( $xbeg, $xlen, $ybeg, $ylen, &$edits)
 
 endDiff ()
 
 lines ( $lines, $prefix=' ')
 Writes all (optionally prefixed) lines to the output buffer, separated by newlines.
 
 startDiff ()
 
 writeOutput ( $text)
 Writes a string to the output buffer.
 

Additional Inherited Members

- Protected Attributes inherited from Wikimedia\Diff\DiffFormatter
int $leadingContextLines = 0
 Number of leading context "lines" to preserve.
 
int $trailingContextLines = 0
 Number of trailing context "lines" to preserve.
 

Detailed Description

MediaWiki default table style diff formatter.

Todo
document
Stability: newable

Definition at line 37 of file TableDiffFormatter.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Diff\TableDiffFormatter::__construct ( )

Definition at line 49 of file TableDiffFormatter.php.

Member Function Documentation

◆ added()

Wikimedia\Diff\TableDiffFormatter::added ( $lines)
protected

Writes all lines to the output buffer, each enclosed in .

Parameters
string[]$lines

Reimplemented from Wikimedia\Diff\DiffFormatter.

Definition at line 187 of file TableDiffFormatter.php.

References $lines, Wikimedia\Diff\TableDiffFormatter\addedLine(), Wikimedia\Diff\TableDiffFormatter\emptyLine(), and Wikimedia\Diff\DiffFormatter\writeOutput().

◆ addedLine()

Wikimedia\Diff\TableDiffFormatter::addedLine ( $line)
protected

HTML-escape parameter before calling this.

Parameters
string$line
Returns
string

Definition at line 119 of file TableDiffFormatter.php.

References Wikimedia\Diff\TableDiffFormatter\wrapLine().

Referenced by Wikimedia\Diff\TableDiffFormatter\added(), and Wikimedia\Diff\TableDiffFormatter\changed().

◆ blockHeader()

Wikimedia\Diff\TableDiffFormatter::blockHeader ( $xbeg,
$xlen,
$ybeg,
$ylen )
protected
Parameters
int$xbeg
int$xlen
int$ybeg
int$ylen
Returns
string

Reimplemented from Wikimedia\Diff\DiffFormatter.

Definition at line 75 of file TableDiffFormatter.php.

◆ changed()

Wikimedia\Diff\TableDiffFormatter::changed ( $orig,
$closing )
protected

Writes the two sets of lines to the output buffer, each enclosed in .

Parameters
string[]$orig
string[]$closing

Reimplemented from Wikimedia\Diff\DiffFormatter.

Definition at line 257 of file TableDiffFormatter.php.

References Wikimedia\Diff\TableDiffFormatter\addedLine(), Wikimedia\Diff\TableDiffFormatter\deletedLine(), Wikimedia\Diff\TableDiffFormatter\emptyLine(), and Wikimedia\Diff\DiffFormatter\writeOutput().

◆ context()

Wikimedia\Diff\TableDiffFormatter::context ( $lines)
protected

Writes all lines to the output buffer, each enclosed in .

Parameters
string[]$lines

Reimplemented from Wikimedia\Diff\DiffFormatter.

Definition at line 237 of file TableDiffFormatter.php.

References $lines, Wikimedia\Diff\TableDiffFormatter\contextLine(), and Wikimedia\Diff\DiffFormatter\writeOutput().

◆ contextLine()

Wikimedia\Diff\TableDiffFormatter::contextLine ( $line,
string $side )
protected

HTML-escape parameter before calling this.

Parameters
string$line
string$sideself::SIDE_DELETED or self::SIDE_ADDED
Returns
string

Definition at line 142 of file TableDiffFormatter.php.

References Wikimedia\Diff\TableDiffFormatter\wrapLine().

Referenced by Wikimedia\Diff\TableDiffFormatter\context().

◆ deleted()

Wikimedia\Diff\TableDiffFormatter::deleted ( $lines)
protected

Writes all lines to the output buffer, each enclosed in .

Parameters
string[]$lines

Reimplemented from Wikimedia\Diff\DiffFormatter.

Definition at line 212 of file TableDiffFormatter.php.

References $lines, Wikimedia\Diff\TableDiffFormatter\deletedLine(), Wikimedia\Diff\TableDiffFormatter\emptyLine(), and Wikimedia\Diff\DiffFormatter\writeOutput().

◆ deletedLine()

Wikimedia\Diff\TableDiffFormatter::deletedLine ( $line)
protected

HTML-escape parameter before calling this.

Parameters
string$line
Returns
string

Definition at line 130 of file TableDiffFormatter.php.

References Wikimedia\Diff\TableDiffFormatter\wrapLine().

Referenced by Wikimedia\Diff\TableDiffFormatter\changed(), and Wikimedia\Diff\TableDiffFormatter\deleted().

◆ emptyLine()

Wikimedia\Diff\TableDiffFormatter::emptyLine ( string $side)
protected
Parameters
string$sideself::SIDE_DELETED or self::SIDE_ADDED
Returns
string

Definition at line 178 of file TableDiffFormatter.php.

Referenced by Wikimedia\Diff\TableDiffFormatter\added(), Wikimedia\Diff\TableDiffFormatter\changed(), and Wikimedia\Diff\TableDiffFormatter\deleted().

◆ endBlock()

Wikimedia\Diff\TableDiffFormatter::endBlock ( )
protected

Called at the end of a block of connected edits.This default implementation does nothing.

Reimplemented from Wikimedia\Diff\DiffFormatter.

Definition at line 101 of file TableDiffFormatter.php.

◆ escapeWhiteSpace()

static Wikimedia\Diff\TableDiffFormatter::escapeWhiteSpace ( $msg)
static
Parameters
string$msg
Returns
string

Definition at line 59 of file TableDiffFormatter.php.

Referenced by Wikimedia\Diff\TableDiffFormatter\wrapLine().

◆ lines()

Wikimedia\Diff\TableDiffFormatter::lines ( $lines,
$prefix = ' ',
$color = 'white' )
protected
Parameters
string[]$lines
string$prefix
string$color

Definition at line 109 of file TableDiffFormatter.php.

◆ startBlock()

Wikimedia\Diff\TableDiffFormatter::startBlock ( $header)
protected

Called at the start of a block of connected edits.This default implementation writes the header and a newline to the output buffer.

Parameters
string$header

Reimplemented from Wikimedia\Diff\DiffFormatter.

Definition at line 96 of file TableDiffFormatter.php.

References $header, and Wikimedia\Diff\DiffFormatter\writeOutput().

◆ wrapLine()

Wikimedia\Diff\TableDiffFormatter::wrapLine ( $marker,
$class,
$line )
protected
Parameters
string$marker
string | string[]$classA single class or a list of classes
string$line
Returns
string

Definition at line 153 of file TableDiffFormatter.php.

References Wikimedia\Diff\TableDiffFormatter\escapeWhiteSpace().

Referenced by Wikimedia\Diff\TableDiffFormatter\addedLine(), Wikimedia\Diff\TableDiffFormatter\contextLine(), and Wikimedia\Diff\TableDiffFormatter\deletedLine().


The documentation for this class was generated from the following file: