blob: 6852d9f8bdc60a13b762e2e9e1eedf3030101bf2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\TranslatorInterface\Insertable;
/**
* Suggester for HTML tags
* @author Niklas Laxström
* @license GPL-2.0-or-later
* @since 2020.12
*/
class HtmlTagInsertablesSuggester implements InsertablesSuggester {
/** @var InsertablesSuggester */
private $suggester;
public function __construct() {
$this->suggester = new RegexInsertablesSuggester( [
'regex' => '~(?<open><([a-z][a-z0-9]*)\b[^>]*>).*?(?<close></\2>)~',
'display' => '$open$close',
'pre' => '$open',
'post' => '$close',
] );
}
public function getInsertables( string $text ): array {
return $this->suggester->getInsertables( $text );
}
}
class_alias( HtmlTagInsertablesSuggester::class, '\MediaWiki\Extensions\Translate\HtmlTagInsertablesSuggester' );
|