Creates a new instance.
Usage:
const wikilink = new mwbot.Wikilink('Page title');
The title of the (non-file) page that the wikilink links to.
Optional
display: stringAn optional display text for the wikilink.
'[[File:...]]'
wikilink,
use FileWikilink instead.Checks if the given object is an instance of the specified wikilink-related class.
This method is an alternative of the instanceof
operator, which cannot be used for
non-exported classes.
Example:
const [foo] = new mwbot.Wikitext('[[Foo]]').parseWikilinks();
foo instanceof mwbot.Wikilink; // true
mwbot.Wikilink.is(foo, 'ParsedWikilink'); // true
foo instanceof mwbot.FileWikilink; // false
mwbot.Wikilink.is(foo, 'ParsedFileWikilink'); // false
foo instanceof mwbot.RawWikilink; // false
mwbot.Wikilink.is(foo, 'ParsedRawWikilink'); // false
Be noted about the hierarchies of the wikilink-related classes:
The type of wikilink to check for. Must be one of 'Wikilink'
, 'ParsedWikilink'
,
'FileWikilink'
, 'ParsedFileWikilink'
, 'RawWikilink'
, or 'ParsedRawWikilink'
.
The object to check.
The wikilink type to compare against.
true
if obj
is an instance of the specified wikilink class, otherwise false
.
This interface defines the static members of the
Wikilink
class. For instance members, see Wikilink (defined separately due to TypeScript limitations).Wikilink
is a class that serves to parse[[wikilink]]
markups into an object structure, which is accessible via Mwbot.Wikilink. Note that wikilinks with a'File:'
title are treated differently by the FileWikilink class, and those with an invalid title by the RawWikilink class.Example