MediaWiki master
MediaWiki\Diff\TextDiffer\ExternalTextDiffer Class Reference

Inherits MediaWiki\Diff\TextDiffer\BaseTextDiffer.

Collaboration diagram for MediaWiki\Diff\TextDiffer\ExternalTextDiffer:

Public Member Functions

 __construct ( $externalPath)
 
 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.
 
- 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.
 
 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.
 
 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.
 

Detailed Description

Since
1.41

Definition at line 11 of file ExternalTextDiffer.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Diff\TextDiffer\ExternalTextDiffer::__construct ( $externalPath)
Parameters
string$externalPathThe path to the executable file which provides the diff

Definition at line 18 of file ExternalTextDiffer.php.

Member Function Documentation

◆ doRenderBatch()

MediaWiki\Diff\TextDiffer\ExternalTextDiffer::doRenderBatch ( string $oldText,
string $newText,
array $formats )
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.

Parameters
string$oldText
string$newText
array$formats
Returns
array

Reimplemented from MediaWiki\Diff\TextDiffer\BaseTextDiffer.

Definition at line 34 of file ExternalTextDiffer.php.

◆ getFormatContext()

MediaWiki\Diff\TextDiffer\ExternalTextDiffer::getFormatContext ( string $format)

Get the context for a given format.

Returns one of the CONTEXT_* constants.

Parameters
string$format
Returns
string

Implements MediaWiki\Diff\TextDiffer\TextDiffer.

Definition at line 30 of file ExternalTextDiffer.php.

◆ getFormats()

MediaWiki\Diff\TextDiffer\ExternalTextDiffer::getFormats ( )

Get the supported format names.

Returns
string[]

Implements MediaWiki\Diff\TextDiffer\TextDiffer.

Definition at line 26 of file ExternalTextDiffer.php.

◆ getName()

MediaWiki\Diff\TextDiffer\ExternalTextDiffer::getName ( )

Get a stable unique name to identify this differ in a cache key.

Implements MediaWiki\Diff\TextDiffer\TextDiffer.

Definition at line 22 of file ExternalTextDiffer.php.


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