Extends
Constructor
new ve.dm.MWLanguageVariantNode()abstract
#
Hierarchy
Children
DataModel MediaWiki language variant node, used to represent LanguageConverter markup.
- Mixes in:
- Source:
DataModel MediaWiki language variant node, used to represent LanguageConverter markup.
Properties
blockTypestatic
#
Node type to use when the contents are a block
Properties:
Type | Description |
---|---|
string |
inlineTypestatic
#
Node type to use when the contents are inline
Properties:
Type | Description |
---|---|
string |
Methods
getRuleType() → {string}
#
Helper function to discriminate between various types of language converter markup.
Returns:
- Type
- string
Helper function to discriminate between various types of language converter markup.
getVariantInfo() → {Object}
#
isHidden() → {boolean}
#
Helper function to discriminate between hidden and shown rules.
Returns:
True if this node represents a conversion rule with no shown output
- Type
- boolean
cloneElement()static
#
describeChanges()static
#
getPreviewHtml(variantInfo, opts) → {string}privatestatic
#
Helper method to return an appropriate HTML preview string for a language converter node, based on the language variant information object and the user's currently preferred variant.
Parameters:
Name | Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
variantInfo |
Object | Language variant information object. |
||||||||||
opts |
Object
|
null
|
Preview options Properties:
|
Returns:
HTML string
- Type
- string
Helper method to return an appropriate HTML preview string for a language converter node, based on the language variant information object and the user's currently preferred variant.
getRuleType(variantInfo) → {string}static
#
Helper function to discriminate between various types of language converter markup.
Parameters:
Name | Type | Description |
---|---|---|
variantInfo |
Object | Language variant information object. |
Returns:
- Type
- string
Helper function to discriminate between various types of language converter markup.
insertPreviewElements(element, variantInfo, opts) → {HTMLElement}static
#
Insert language variant preview for specified element.
Parameters:
Name | Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
element |
HTMLElement | Element to insert preview inside of. |
||||||||||
variantInfo |
Object | Language variant information object. |
||||||||||
opts |
Object
|
null
|
Preview options Properties:
|
Returns:
el
- Type
- HTMLElement
matchLanguage([items]) → {number}static
#
Match the currently-selected language variant against the most appropriate among a provided list of language codes.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
items |
Array.<Object> |
optional |
An array of objects, each of which have a field
named |
Returns:
The index in items
with the most appropriate language
code.
- Type
- number
Match the currently-selected language variant against the most appropriate among a provided list of language codes.
migrateFieldNames(dataMwv) → {Object}privatestatic
#
processVariants(container, opts)static
#
Add previews for language variant markup inside their <span> nodes. This ensures that template expansion, cut-and-paste, etc have reasonable renderings.
Parameters:
Name | Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
container |
HTMLElement | Container element to process |
||||||||||
opts |
Object
|
null
|
Preview options Properties:
|