Expand all

ve.dm.MWMagicLinkNode

Extends

Constructor

new ve.dm.MWMagicLinkNode([element]) #

DataModel MediaWiki magic link node.

Parameters:

Name Type Attributes Description
element Object optional

Reference to element in linear model

Mixes in:
Source:
DataModel MediaWiki magic link node.

Methods

getCode() → {string} #

Return the numeric code associated with this magic link node.

Source:

Returns:

Type
string
Return the numeric code associated with this magic link node.

getHref() → {string} #

Return the link target appropriate for this magic link node.

Source:

Returns:

Link href

Type
string
Return the link target appropriate for this magic link node.

getMagicType() → {string} #

Return the type of this magic link node: one of "RFC", "PMID", or "ISBN".

Source:

Returns:

Magic link type

Type
string
Return the type of this magic link node: one of "RFC", "PMID", or "ISBN".

getRel() → {string} #

Return the rel attribute appropriate for this magic link node.

Source:

Returns:

Either "mw:ExtLink" or "mw:WikiLink"

Type
string
Return the rel attribute appropriate for this magic link node.

annotationFromContent(content) → {ve.dm.MWExternalLinkAnnotation|ve.dm.MWInternalLinkAnnotation|null}static #

Return a link annotation appropriate for converting a magic link with the given content into a simple link, or null if the given content is not a valid magic link.

Parameters:

Name Type Description
content string
Source:

Returns:

Type
ve.dm.MWExternalLinkAnnotation | ve.dm.MWInternalLinkAnnotation | null

Return a link annotation appropriate for converting a magic link with the given content into a simple link, or null if the given content is not a valid magic link.

matchFunction(element) → {boolean}static #

Determine whether the given element is a magic link.

Parameters:

Name Type Description
element HTMLElement
Source:

Returns:

True if the element is a magic link

Type
boolean
Determine whether the given element is a magic link.

toDataElement()static #

toDomElements()static #

validateContent(content, [optType]) → {boolean}static #

Test that a proposed content string is valid for a magic link. If optType is given, additionally verify that the content string is valid for the particular type of magic link (RFC/ISBN/PMID).

Parameters:

Name Type Attributes Description
content string

The content string to test.

optType string optional

The desired type of magic link, one of "RFC", "ISBN", or "PMID". If not supplied, returns true if the content is valid for any one of these.

Source:

Returns:

True if the content string is valid for a magic link of the appropriate type (or any type).

Type
boolean
Test that a proposed content string is valid for a magic link.

validateHref(content, href) → {boolean}static #

Test that a proposed content string and href is valid for a magic link.

Parameters:

Name Type Description
content string

The content string to test.

href string

The URL target of the magic link.

Source:

Returns:

True if the content string and href are valid for a magic link.

Type
boolean
Test that a proposed content string and href is valid for a magic link.