MediaWiki master
|
An interface for parts of a diff page view which represent changes to text. More...
Inherited by MediaWiki\Diff\TextDiffer\BaseTextDiffer, and MediaWiki\Diff\TextDiffer\ManifoldTextDiffer.
Public Member Functions | |
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. | |
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. | |
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. | |
localize (string $format, string $diff, array $options=[]) | |
Expand messages in the diff text using the current MessageLocalizer. | |
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. | |
Public Attributes | |
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. | |
An interface for parts of a diff page view which represent changes to text.
Definition at line 12 of file TextDiffer.php.
MediaWiki\Diff\TextDiffer\TextDiffer::addModules | ( | OutputPage | $out, |
string | $format ) |
Modify the OutputPage, adding any headers required by the specified format.
OutputPage | $out | |
string | $format |
Implemented in MediaWiki\Diff\TextDiffer\BaseTextDiffer, and MediaWiki\Diff\TextDiffer\ManifoldTextDiffer.
MediaWiki\Diff\TextDiffer\TextDiffer::addRowWrapper | ( | string | $format, |
string | $diffText ) |
Make the context consistent by adding a colspan=4 wrapper around plain HTML output.
string | $format | |
string | $diffText |
Implemented in MediaWiki\Diff\TextDiffer\BaseTextDiffer, and MediaWiki\Diff\TextDiffer\ManifoldTextDiffer.
MediaWiki\Diff\TextDiffer\TextDiffer::getCacheKeys | ( | array | $formats | ) |
Get additional cache keys required by the specified formats.
The result should have unique string keys, so that cache keys can be deduplicated.
string[] | $formats |
Implemented in MediaWiki\Diff\TextDiffer\BaseTextDiffer, MediaWiki\Diff\TextDiffer\ManifoldTextDiffer, and MediaWiki\Diff\TextDiffer\Wikidiff2TextDiffer.
MediaWiki\Diff\TextDiffer\TextDiffer::getFormatContext | ( | string | $format | ) |
Get the context for a given format.
Returns one of the CONTEXT_* constants.
string | $format |
Implemented in MediaWiki\Diff\TextDiffer\ExternalTextDiffer, MediaWiki\Diff\TextDiffer\ManifoldTextDiffer, MediaWiki\Diff\TextDiffer\PhpTextDiffer, and MediaWiki\Diff\TextDiffer\Wikidiff2TextDiffer.
MediaWiki\Diff\TextDiffer\TextDiffer::getFormats | ( | ) |
Get the supported format names.
Implemented in MediaWiki\Diff\TextDiffer\ExternalTextDiffer, MediaWiki\Diff\TextDiffer\ManifoldTextDiffer, MediaWiki\Diff\TextDiffer\PhpTextDiffer, and MediaWiki\Diff\TextDiffer\Wikidiff2TextDiffer.
MediaWiki\Diff\TextDiffer\TextDiffer::getName | ( | ) |
Get a stable unique name to identify this differ in a cache key.
Implemented in MediaWiki\Diff\TextDiffer\ExternalTextDiffer, MediaWiki\Diff\TextDiffer\ManifoldTextDiffer, MediaWiki\Diff\TextDiffer\PhpTextDiffer, and MediaWiki\Diff\TextDiffer\Wikidiff2TextDiffer.
MediaWiki\Diff\TextDiffer\TextDiffer::getPreferredFormatBatch | ( | string | $format | ) |
Given a format, get a list of formats which can be generated at the same time with minimal additional CPU cost.
string | $format |
Implemented in MediaWiki\Diff\TextDiffer\BaseTextDiffer, MediaWiki\Diff\TextDiffer\ManifoldTextDiffer, and MediaWiki\Diff\TextDiffer\Wikidiff2TextDiffer.
MediaWiki\Diff\TextDiffer\TextDiffer::getTablePrefixes | ( | string | $format | ) |
Get table prefixes for the specified format.
These are HTML fragments placed above all slot diffs. The key should be a string, used for sorting and deduplication.
string | $format |
Implemented in MediaWiki\Diff\TextDiffer\BaseTextDiffer, MediaWiki\Diff\TextDiffer\ManifoldTextDiffer, and MediaWiki\Diff\TextDiffer\Wikidiff2TextDiffer.
MediaWiki\Diff\TextDiffer\TextDiffer::hasFormat | ( | string | $format | ) |
Determine whether we support the specified format.
string | $format |
Implemented in MediaWiki\Diff\TextDiffer\BaseTextDiffer, and MediaWiki\Diff\TextDiffer\ManifoldTextDiffer.
MediaWiki\Diff\TextDiffer\TextDiffer::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:
|
Implemented in MediaWiki\Diff\TextDiffer\BaseTextDiffer, MediaWiki\Diff\TextDiffer\ManifoldTextDiffer, MediaWiki\Diff\TextDiffer\PhpTextDiffer, and MediaWiki\Diff\TextDiffer\Wikidiff2TextDiffer.
MediaWiki\Diff\TextDiffer\TextDiffer::render | ( | string | $oldText, |
string | $newText, | ||
string | $format ) |
Generate a diff comparing $oldText with $newText.
The result must be passed through localize() before being sent to the user.
string | $oldText | |
string | $newText | |
string | $format |
Implemented in MediaWiki\Diff\TextDiffer\BaseTextDiffer, and MediaWiki\Diff\TextDiffer\ManifoldTextDiffer.
MediaWiki\Diff\TextDiffer\TextDiffer::renderBatch | ( | string | $oldText, |
string | $newText, | ||
array | $formats ) |
Render a diff in multiple formats.
The results must be passed through localize() before being sent to the user.
string | $oldText | |
string | $newText | |
string[] | $formats |
Implemented in MediaWiki\Diff\TextDiffer\BaseTextDiffer, and MediaWiki\Diff\TextDiffer\ManifoldTextDiffer.
const MediaWiki\Diff\TextDiffer\TextDiffer::CONTEXT_PLAIN = 'plain' |
The HTML returned is an ordinary block.
Definition at line 16 of file TextDiffer.php.
const MediaWiki\Diff\TextDiffer\TextDiffer::CONTEXT_PRE = 'pre' |
The return value is plain text and should be wrapped in a.
Definition at line 26 of file TextDiffer.php.
const MediaWiki\Diff\TextDiffer\TextDiffer::CONTEXT_ROW = 'row' |
The HTML returned is zero or more table rows.
Definition at line 21 of file TextDiffer.php.