config/WikiConfig~WikiConfig(parsoidConfig, resultConf, prefix)

Show:

new WikiConfig(parsoidConfig, resultConf, prefix)

Per-wiki configuration object.

Per-wiki configuration object.

Parameters:
Name Type Description
parsoidConfig ParsoidConfig
resultConf Object

The configuration object from a MediaWiki API request. See the #ConfigRequest class in lib/mediawiki.ApiRequest.js for information about how we get this object. If null, we use the contents of lib/mediawiki.BaseConfig.json instead.

prefix string

The interwiki prefix this config will represent. Will be used for caching elsewhere in the code.

Source:

Members

ExtResourceURLPatternMatcher

Matcher for RFC/PMID URL patterns, returning the type and number.

Matcher for RFC/PMID URL patterns, returning the type and number. The match method takes a string and returns false on no match or a tuple like this on match: ['RFC', '12345']

Properties:
Name Type Description
ExtResourceURLPatternMatcher Object
Properties
Name Type Description
match function
Source:

Methods

detectFeatures() → {Promise}

Detect which parameters are available in the MediaWiki API.

Detect which parameters are available in the MediaWiki API.

Source:
Returns:
Type
Promise

findValidProtocol(potentialLink) → {boolean}

Matcher for valid protocols, may occur at any point within string.

Matcher for valid protocols, may occur at any point within string.

Parameters:
Name Type Description
potentialLink string
Source:
Returns:
Type
boolean

getMagicWordIdFromAlias(alias) → {string|null}

Get the canonical name of a magic word alias.

Get the canonical name of a magic word alias.

Parameters:
Name Type Description
alias string
Source:
Returns:
Type
string | null

getMagicWordMatcher(id) → {RegExp}

Get a regexp matching a localized magic word, given its id.

Get a regexp matching a localized magic word, given its id.

Parameters:
Name Type Description
id string
Source:
Returns:
Type
RegExp

getMagicWordWT()

Convert the internal canonical magic word name to the wikitext alias.

Convert the internal canonical magic word name to the wikitext alias.

Source:

getParameterizedAliasMatcher(optionsMap) → {function}

Get a matcher function for fetching values out of "magic words" with $1 in their aliases.

Get a matcher function for fetching values out of "magic words" with $1 in their aliases.

Parameters:
Name Type Description
optionsMap Map

The map of options you want to check for (eg the map of all interpolated image options).

Source:
Returns:
Type
function

hasValidProtocol(potentialLink) → {boolean}

Matcher for valid protocols, must be anchored at start of string.

Matcher for valid protocols, must be anchored at start of string.

Parameters:
Name Type Description
potentialLink string
Source:
Returns:
Type
boolean

isMagicWord(word) → {boolean}

Check if a string is a recognized magic word.

Check if a string is a recognized magic word.

Parameters:
Name Type Description
word string
Source:
Returns:
Type
boolean

magicWordCanonicalName(word) → {string}

Get canonical magicword name for the input word.

Get canonical magicword name for the input word.

Parameters:
Name Type Description
word string
Source:
Returns:
Type
string

replaceInterpolatedMagicWord(alias, value) → {string}

Builds a magic word string out of an alias with $1 in it and a value for the option.

Builds a magic word string out of an alias with $1 in it and a value for the option.

Parameters:
Name Type Description
alias string
value string
Source:
Returns:
Type
string