- Source:
Members
(static) linkTrailRegex
This regex was generated by running through all unicode characters and testing them against all regexes for linktrails in a default MW install.
This regex was generated by running through all unicode characters and testing them against all regexes for linktrails in a default MW install. We had to treat it a little bit, here's what we changed:
- A-Z, though allowed in Walloon, is disallowed.
- '"', though allowed in Chuvash, is disallowed.
- '-', though allowed in Icelandic (possibly due to a bug), is disallowed.
- '1', though allowed in Lak (possibly due to a bug), is disallowed.
Properties:
Type | Description |
---|---|
RegExp |
- Source:
(static) magicMasqs
Methods
(static) bcp47(code) → {string}
Convert mediawiki-format language code to a BCP47-compliant language code suitable for including in HTML.
Convert mediawiki-format language code to a BCP47-compliant language
code suitable for including in HTML. See
GlobalFunctions.php::wfBCP47()
in mediawiki sources.
Parameters:
Name | Type | Description |
---|---|---|
code |
string | Mediawiki language code. |
- Source:
Returns:
BCP47 language code.
- Type
- string
(static) decodeWtEntities(text) → {string}
Decode HTML5 entities in wikitext.
NOTE that wikitext only allows semicolon-terminated entities, while HTML allows a number of "legacy" entities to be decoded without a terminating semicolon. This function deliberately does not decode these HTML-only entity forms.
Parameters:
Name | Type | Description |
---|---|---|
text |
string |
- Source:
Returns:
- Type
- string
(static) entityEncodeAll(s) → {string}
Encode all characters as entity references. This is done to make characters safe for wikitext (regardless of whether they are HTML-safe).
Parameters:
Name | Type | Description |
---|---|---|
s |
string |
- Source:
Returns:
- Type
- string
(static) escapeWtEntities(text) → {string}
Entity-escape anything that would decode to a valid wikitext entity.
Note that HTML5 allows certain "semicolon-less" entities, like
¶
; these aren't allowed in wikitext and won't be escaped
by this function.
Parameters:
Name | Type | Description |
---|---|---|
text |
string |
- Source:
Returns:
- Type
- string
(static) extendProps(tgt, …subject) → {Object}
Update only those properties that are undefined or null in the target.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tgt |
Object | The object to modify. |
|
subject |
Object |
<repeatable> |
The object to extend tgt with. Add more arguments to the function call to chain more extensions. |
- Source:
Returns:
The modified object.
- Type
- Object
(static) isLinkTrail(text) → {boolean}
Check whether some text is a valid link trail.
Parameters:
Name | Type | Description |
---|---|---|
text |
string |
- Source:
Returns:
- Type
- boolean
(static) isProtocolValid()
Determine whether the protocol of a link is potentially valid. Use the environment's per-wiki config to do so.
- Source:
(static) isVoidElement()
Determine if the named tag is void (can not have content).
- Source:
(static) lastUniChar()
Extract the last unicode character of the string. This might be more than one javascript character, if the last character is a martian.
- Source:
(static) makeHash(arr)
(static) namespaceEquals(n1, n2) → {boolean}
Compare two namespaces for equality.
Parameters:
Name | Type | Description |
---|---|---|
n1 |
Namespace | |
n2 |
Namespace |
- Source:
Returns:
- Type
- boolean
(static) normalizeNamespaceName(name) → {string}
Cannonicalizes a namespace name.
Used by WikiConfig.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Non-normalized namespace name. |
- Source:
Returns:
- Type
- string
(static) phpTrim()
Emulate PHP's trim, which is almost-but-not-quite like JS's trim.
PHP: https://www.php.net/manual/en/function.trim.php
JS: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim
- Source:
(static) phpURLEncode()
Emulate PHP's urlencode by patching results of
JS's encodeURIComponent
.
Emulate PHP's urlencode by patching results of
JS's encodeURIComponent
.
PHP: https://secure.php.net/manual/en/function.urlencode.php
JS: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
Spaces to '+' is a PHP peculiarity as well.
- Source:
(static) titleEquals(t1, t2) → {boolean}
Compare two titles for equality.
Parameters:
Name | Type | Description |
---|---|---|
t1 |
Title | |
t2 |
Title |
- Source:
Returns:
- Type
- boolean