Class: WikiLinkHandler

wt2html/tt/LinkHandler~WikiLinkHandler()

new WikiLinkHandler()

...

Extends

Methods

(static) getFormat()

Get the format for media.

Get the format for media.

Source:

(static) getOptionInfo() → {Object|string|string|string|string}

Determine the name of an option.

Determine the name of an option.

Source:
Returns:
  • Type
    Object
  • return.ck Canonical key for the image option.

    Type
    string
  • return.v Value of the option.

    Type
    string
  • return.ak Aliased key for the image option - includes "$1" for placeholder.

    Type
    string
  • return.s Whether it's a simple option or one with a value.

    Type
    string

(static) handleSize()

Extract the dimensions for media.

Extract the dimensions for media.

Source:

(static) stringifyOptionTokens(tstream, prefix) → {string|null}

Make option token streams into a stringy thing that we can recognize.

Make option token streams into a stringy thing that we can recognize.

Parameters:
Name Type Description
tstream Array
prefix string

Anything that came before this part of the recursive call stack.

Source:
Returns:
Type
string | null

_wikiLinkHandler()

Figure out which handler to use to render a given WikiLink token.

Figure out which handler to use to render a given WikiLink token. Override this method to add new handlers or swap out existing handlers based on the target structure.

Source:

addLinkAttributesAndGetContent() → {Array}

Generic wiki link attribute setup on a passed-in new token based on the wikilink token and target.

Generic wiki link attribute setup on a passed-in new token based on the wikilink token and target. As a side effect, this method also extracts the link content tokens and returns them.

Source:
Returns:

Content tokens.

Type
Array

getWikiLinkTargetInfo() → {Object}

Normalize and analyze a wikilink target.

Normalize and analyze a wikilink target.

Returns an object containing

  • href: The expanded target string
  • hrefSrc: The original target wikitext
  • title: A title object or
  • language: An interwikiInfo object or
  • interwiki: An interwikiInfo object.
  • localprefix: Set if the link had a localinterwiki prefix (or prefixes)
  • fromColonEscapedText: Target was colon-escaped ([[:en:foo]])
  • prefix: The original namespace or language/interwiki prefix without a colon escape.
Source:
Returns:

The target info.

Type
Object

(generator) onRedirectG()

Handle mw:redirect tokens.

Handle mw:redirect tokens.

Source:

(generator) onWikiLinkG()

Handle a mw:WikiLink token.

Handle a mw:WikiLink token.

Source:

(generator) renderCategoryG()

Render a category 'link'.

Render a category 'link'. Categories are really page properties, and are normally rendered in a box at the bottom of an article.

Source:

(generator) renderFileG()

Render a file.

Render a file. This can be an image, a sound, a PDF etc.

Source:

(generator) renderInterwikiLinkG()

Render an interwiki link.

Render an interwiki link.

Source:

(generator) renderLanguageLinkG()

Render a language link.

Render a language link. Those normally appear in the list of alternate languages for an article in the sidebar, so are really a page property.

Source:

(generator) renderWikiLinkG()

Render a plain wiki link.

Render a plain wiki link.

Source: