MediaWiki
1.28.0
|
Base class for diff formatters. More...
Public Member Functions | |
format ($diff) | |
Format a diff. More... | |
Protected Member Functions | |
added ($lines) | |
block ($xbeg, $xlen, $ybeg, $ylen, &$edits) | |
blockHeader ($xbeg, $xlen, $ybeg, $ylen) | |
changed ($orig, $closing) | |
Writes the two sets of lines to the output buffer, separated by "---" and a newline. More... | |
context ($lines) | |
deleted ($lines) | |
endBlock () | |
Called at the end of a block of connected edits. More... | |
endDiff () | |
lines ($lines, $prefix= ' ') | |
Writes all (optionally prefixed) lines to the output buffer, separated by newlines. More... | |
startBlock ($header) | |
Called at the start of a block of connected edits. More... | |
startDiff () | |
writeOutput ($text) | |
Writes a string to the output buffer. More... | |
Protected Attributes | |
int | $leadingContextLines = 0 |
Number of leading context "lines" to preserve. More... | |
int | $trailingContextLines = 0 |
Number of trailing context "lines" to preserve. More... | |
Private Attributes | |
string | $result = '' |
The output buffer; holds the output while it is built. More... | |
Base class for diff formatters.
This class formats the diff in classic diff format. It is intended that this class be customized via inheritance, to obtain fancier outputs.
Definition at line 36 of file DiffFormatter.php.
|
protected |
|
protected |
int | $xbeg | |
int | $xlen | |
int | $ybeg | |
int | $ylen | |
array | $edits |
MWException | If the edit type is not known. |
Definition at line 133 of file DiffFormatter.php.
References added(), as, blockHeader(), changed(), context(), deleted(), endBlock(), and startBlock().
Referenced by format().
|
protected |
int | $xbeg | |
int | $xlen | |
int | $ybeg | |
int | $ylen |
Definition at line 182 of file DiffFormatter.php.
Referenced by block().
|
protected |
Writes the two sets of lines to the output buffer, separated by "---" and a newline.
string[] | $orig |
string[] | $closing |
Definition at line 249 of file DiffFormatter.php.
References added(), deleted(), and writeOutput().
Referenced by block().
|
protected |
string[] | $lines |
Definition at line 225 of file DiffFormatter.php.
References $lines, and lines().
Referenced by block().
|
protected |
|
protected |
Called at the end of a block of connected edits.
This default implementation does nothing.
Definition at line 207 of file DiffFormatter.php.
Referenced by block().
|
protected |
Definition at line 167 of file DiffFormatter.php.
References $result.
Referenced by format().
DiffFormatter::format | ( | $diff | ) |
Format a diff.
Diff | $diff |
Definition at line 62 of file DiffFormatter.php.
References $context, $leadingContextLines, $trailingContextLines, as, block(), endDiff(), and startDiff().
|
protected |
Writes all (optionally prefixed) lines to the output buffer, separated by newlines.
string[] | $lines | |
string | $prefix |
Definition at line 216 of file DiffFormatter.php.
References $line, $lines, as, and writeOutput().
|
protected |
Called at the start of a block of connected edits.
This default implementation writes the header and a newline to the output buffer.
string | $header |
Definition at line 199 of file DiffFormatter.php.
References $header, and writeOutput().
Referenced by block().
|
protected |
Definition at line 151 of file DiffFormatter.php.
Referenced by format().
|
protected |
Writes a string to the output buffer.
string | $text |
Definition at line 160 of file DiffFormatter.php.
Referenced by TableDiffFormatter\added(), TableDiffFormatter\changed(), changed(), TableDiffFormatter\context(), TableDiffFormatter\deleted(), UnifiedDiffFormatter\lines(), lines(), TableDiffFormatter\startBlock(), and startBlock().
|
protected |
Number of leading context "lines" to preserve.
This should be left at zero for this class, but subclasses may want to set this to other values.
Definition at line 43 of file DiffFormatter.php.
Referenced by format().
|
private |
The output buffer; holds the output while it is built.
Definition at line 53 of file DiffFormatter.php.
Referenced by endDiff().
|
protected |
Number of trailing context "lines" to preserve.
This should be left at zero for this class, but subclasses may want to set this to other values.
Definition at line 50 of file DiffFormatter.php.
Referenced by format().