Expand all

abstract ve.dm.MWLanguageVariantNode

Extends

Constructor

new ve.dm.MWLanguageVariantNode()abstract #

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
Source:
Node type to use when the contents are a block

hiddenTypestatic #

Node type to use when the contents are hidden

Properties:

Type Description
string
Source:
Node type to use when the contents are hidden

inlineTypestatic #

Node type to use when the contents are inline

Properties:

Type Description
string
Source:
Node type to use when the contents are inline

Methods

getRuleType() → {string} #

Helper function to discriminate between various types of language converter markup.

Source:

Returns:

Type
string

Helper function to discriminate between various types of language converter markup.

getVariantInfo() → {Object} #

Helper function to get the description object for this markup node.

Source:

Returns:

Type
Object
Helper function to get the description object for this markup node.

isHidden() → {boolean} #

Helper function to discriminate between hidden and shown rules.

Source:

Returns:

True if this node represents a conversion rule with no shown output

Type
boolean
Helper function to discriminate between hidden and shown rules.

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:
Name Type Attributes Default Description
describeAll boolean optional
false

Treat all rules as if the "describe" flag was set. This displays every language and its associated text, not just the one appropriate for the current user.

Source:

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.

Source:

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:
Name Type Attributes Default Description
describeAll boolean optional
false

Treat all rules as if the "describe" flag was set. This displays every language and its associated text, not just the one appropriate for the current user.

Source:

Returns:

el

Type
HTMLElement
Insert language variant preview for specified element.

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 l equal to a language code.

Source:

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 #

Migrate field names from old Parsoid spec to new field names. This method will go away after the next Parsoid flag day.

Parameters:

Name Type Description
dataMwv Object
Source:

Returns:

Type
Object
Migrate field names from old Parsoid spec to new field names.

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:
Name Type Attributes Default Description
describeAll boolean optional
false

Treat all rules as if the "describe" flag was set. This displays every language and its associated text, not just the one appropriate for the current user.

Source:
Add previews for language variant markup inside their <span> nodes.