summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Translate/insertables/MediaWikiInsertablesSuggester.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/Translate/insertables/MediaWikiInsertablesSuggester.php')
-rw-r--r--www/wiki/extensions/Translate/insertables/MediaWikiInsertablesSuggester.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/www/wiki/extensions/Translate/insertables/MediaWikiInsertablesSuggester.php b/www/wiki/extensions/Translate/insertables/MediaWikiInsertablesSuggester.php
index f4a9cbff..11aea35b 100644
--- a/www/wiki/extensions/Translate/insertables/MediaWikiInsertablesSuggester.php
+++ b/www/wiki/extensions/Translate/insertables/MediaWikiInsertablesSuggester.php
@@ -2,7 +2,7 @@
/**
* @file
* @author Niklas Laxström
- * @license GPL-2.0+
+ * @license GPL-2.0-or-later
*/
/**
@@ -12,27 +12,34 @@
*/
class MediaWikiInsertablesSuggester {
public function getInsertables( $text ) {
- $insertables = array();
+ $insertables = [];
- $matches = array();
+ $matches = [];
preg_match_all( '/\$(1[a-z]+|[0-9]+)/', $text, $matches, PREG_SET_ORDER );
- $new = array_map( function( $match ) {
+ $new = array_map( function ( $match ) {
return new Insertable( $match[0], $match[0] );
}, $matches );
$insertables = array_merge( $insertables, $new );
- $matches = array();
+ $matches = [];
preg_match_all(
'/({{((?:PLURAL|GENDER|GRAMMAR):[^|]*)\|).*?(}})/i',
$text,
$matches,
PREG_SET_ORDER
);
- $new = array_map( function( $match ) {
+ $new = array_map( function ( $match ) {
return new Insertable( $match[2], $match[1], $match[3] );
}, $matches );
$insertables = array_merge( $insertables, $new );
+ $matches = [];
+ preg_match_all( '/<\/?[a-z]+>/', $text, $matches, PREG_SET_ORDER );
+ $new = array_map( function ( $match ) {
+ return new Insertable( $match[0], $match[0] );
+ }, $matches );
+ $insertables = array_merge( $insertables, $new );
+
return $insertables;
}
}