MediaWiki master
TextDiffer.php
Go to the documentation of this file.
1<?php
2
4
6
12interface TextDiffer {
16 public const CONTEXT_PLAIN = 'plain';
17
21 public const CONTEXT_ROW = 'row';
22
26 public const CONTEXT_PRE = 'pre';
27
31 public function getName(): string;
32
38 public function getFormats(): array;
39
46 public function hasFormat( string $format ): bool;
47
54 public function getFormatContext( string $format );
55
64 public function addRowWrapper( string $format, string $diffText ): string;
65
75 public function render( string $oldText, string $newText, string $format ): string;
76
86 public function renderBatch( string $oldText, string $newText, array $formats ): array;
87
95 public function addModules( OutputPage $out, string $format ): void;
96
106 public function getCacheKeys( array $formats ): array;
107
119 public function localize( string $format, string $diff, array $options = [] ): string;
120
129 public function getTablePrefixes( string $format ): array;
130
138 public function getPreferredFormatBatch( string $format ): array;
139}
This is one of the Core classes and should be read at least once by any new developers.
An interface for parts of a diff page view which represent changes to text.
renderBatch(string $oldText, string $newText, array $formats)
Render a diff in multiple formats.
getFormatContext(string $format)
Get the context for a given format.
getTablePrefixes(string $format)
Get table prefixes for the specified format.
const CONTEXT_PLAIN
The HTML returned is an ordinary block.
getFormats()
Get the supported format names.
hasFormat(string $format)
Determine whether we support the specified format.
getName()
Get a stable unique name to identify this differ in a cache key.
const CONTEXT_ROW
The HTML returned is zero or more table rows.
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.
getPreferredFormatBatch(string $format)
Given a format, get a list of formats which can be generated at the same time with minimal additional...
render(string $oldText, string $newText, string $format)
Generate a diff comparing $oldText with $newText.
const CONTEXT_PRE
The return value is plain text and should be wrapped in a.
localize(string $format, string $diff, array $options=[])
Expand messages in the diff text using the current MessageLocalizer.
getCacheKeys(array $formats)
Get additional cache keys required by the specified formats.