MediaWiki
master
MwUrlModule.php
Go to the documentation of this file.
1
<?php
21
namespace
MediaWiki\ResourceLoader
;
22
27
class
MwUrlModule
{
33
public
static
function
makeJsFromExtendedRegExp
(
string
$content ): string {
34
// Remove whitespace.
35
$content = preg_replace(
'/\s+/'
,
''
, $content );
36
// Remove named capturing groups.
37
// This allows long regexes to be self-documenting, which we allow for
38
// developer convenience, but this syntax is invalid JavaScript ES5.
39
$content = preg_replace(
'/\?<\w+?>/'
,
''
, $content );
40
// Format as a valid JavaScript import.
41
return
'module.exports = /'
. strtr( $content, [
'/'
=>
'\/'
] ) .
'/;'
;
42
}
43
}
MediaWiki\ResourceLoader\MwUrlModule
Definition
MwUrlModule.php:27
MediaWiki\ResourceLoader\MwUrlModule\makeJsFromExtendedRegExp
static makeJsFromExtendedRegExp(string $content)
Definition
MwUrlModule.php:33
MediaWiki\ResourceLoader
Definition
CircularDependencyError.php:21
includes
ResourceLoader
MwUrlModule.php
Generated on Thu Nov 21 2024 10:25:11 for MediaWiki by
1.10.0