MediaWiki master
|
Inherits MediaWiki\Diff\TextDiffer\BaseTextDiffer.
Public Member Functions | |
__construct (?Language $contentLanguage) | |
getFormatContext (string $format) | |
Get the context for a given format. | |
getFormats () | |
Get the supported format names. | |
getName () | |
Get a stable unique name to identify this differ in a cache key. | |
localize (string $format, string $diff, array $options=[]) | |
Expand messages in the diff text using the current MessageLocalizer. | |
Public Member Functions inherited from MediaWiki\Diff\TextDiffer\BaseTextDiffer | |
addModules (OutputPage $out, string $format) | |
Modify the OutputPage, adding any headers required by the specified format. | |
addRowWrapper (string $format, string $diffText) | |
Make the context consistent by adding a colspan=4 wrapper around plain HTML output. | |
getCacheKeys (array $formats) | |
Get additional cache keys required by the specified formats. | |
getPreferredFormatBatch (string $format) | |
Given a format, get a list of formats which can be generated at the same time with minimal additional CPU cost. | |
getTablePrefixes (string $format) | |
Get table prefixes for the specified format. | |
hasFormat (string $format) | |
Determine whether we support the specified format. | |
render (string $oldText, string $newText, string $format) | |
Generate a diff comparing $oldText with $newText. | |
renderBatch (string $oldText, string $newText, array $formats) | |
Render a diff in multiple formats. | |
setLocalizer (MessageLocalizer $localizer) | |
Protected Member Functions | |
doRenderBatch (string $oldText, string $newText, array $formats) | |
Subclasses should override this to render diffs in the specified formats. | |
Protected Member Functions inherited from MediaWiki\Diff\TextDiffer\BaseTextDiffer | |
getLocalizer () | |
Provide a MessageLocalizer, or throw if setLocalizer() has not been called. | |
localizeLineNumbers ( $text, $reducedLineNumbers) | |
Replace a common convention for language-independent line numbers with the text in the language of the current localizer. | |
validateFormats ( $formats) | |
Throw an exception if any of the formats in the array is not supported. | |
Additional Inherited Members | |
Public Attributes inherited from MediaWiki\Diff\TextDiffer\TextDiffer | |
const | CONTEXT_PLAIN = 'plain' |
The HTML returned is an ordinary block. | |
const | CONTEXT_PRE = 'pre' |
The return value is plain text and should be wrapped in a. | |
const | CONTEXT_ROW = 'row' |
The HTML returned is zero or more table rows. | |
Definition at line 13 of file PhpTextDiffer.php.
MediaWiki\Diff\TextDiffer\PhpTextDiffer::__construct | ( | ?Language | $contentLanguage | ) |
Definition at line 17 of file PhpTextDiffer.php.
|
protected |
Subclasses should override this to render diffs in the specified formats.
The $formats array is guaranteed to not be empty and to contain only formats supported by the subclass.
string | $oldText | |
string | $newText | |
array | $formats |
Reimplemented from MediaWiki\Diff\TextDiffer\BaseTextDiffer.
Definition at line 33 of file PhpTextDiffer.php.
MediaWiki\Diff\TextDiffer\PhpTextDiffer::getFormatContext | ( | string | $format | ) |
Get the context for a given format.
Returns one of the CONTEXT_* constants.
string | $format |
Implements MediaWiki\Diff\TextDiffer\TextDiffer.
Definition at line 29 of file PhpTextDiffer.php.
MediaWiki\Diff\TextDiffer\PhpTextDiffer::getFormats | ( | ) |
Get the supported format names.
Implements MediaWiki\Diff\TextDiffer\TextDiffer.
Definition at line 25 of file PhpTextDiffer.php.
MediaWiki\Diff\TextDiffer\PhpTextDiffer::getName | ( | ) |
Get a stable unique name to identify this differ in a cache key.
Implements MediaWiki\Diff\TextDiffer\TextDiffer.
Definition at line 21 of file PhpTextDiffer.php.
MediaWiki\Diff\TextDiffer\PhpTextDiffer::localize | ( | string | $format, |
string | $diff, | ||
array | $options = [] ) |
Expand messages in the diff text using the current MessageLocalizer.
Perform any other necessary post-cache transformations.
string | $format | |
string | $diff | |
array | $options | An associative array of options, may contain:
|
Reimplemented from MediaWiki\Diff\TextDiffer\BaseTextDiffer.
Definition at line 64 of file PhpTextDiffer.php.