Class Wikitext

The Wikitext class with methods to manipulate wikitext.

Hierarchy

  • Wikitext

Constructors

Properties

parameters: null | Parameter[]

Stores the return value of parseParameters.

A deep copy can be retrieved by getParameters.

revision: null | Revision

Stores the return value of fetch when a Wikitext instance is created by newFromTitle.

A deep copy can be retrieved by getRevision.

sections: null | Section[]

Stores the return value of parseSections.

A deep copy can be retrieved by getSections.

tags: null | Tag[]

Stores the return value of parseTags.

A deep copy can be retrieved by getTags.

wikitext: string

The wikitext from which the Wikitext instance was initialized.

Accessors

  • get byteLength(): number
  • Returns the byte length of the wikitext.

    Returns number

  • get length(): number
  • Returns the length of the wikitext.

    Returns number

Methods

  • Get a deep copy of tags, which is a private property available only when parseTags has been called at least once. Note that parseTags returns a (filtered) deep copy of tags on a non-first call, so simply call the relevant method if there is no need for a null return.

    Returns null | Tag[]

  • Check whether a substring of the wikitext starting and ending at a given index is inside any transclusion-preventing tag.

    Parameters

    • tpTags: Tag[]

      An array of transclusion-preventing tags fetched by parseTags.

    • startIndex: number

      The start index of the string in the wikitext.

    • endIndex: number

      The end index of the string in the wikitext.

    Returns boolean

  • Fetch the wikitext of a page with additional information on the current revision.

    Parameters

    • pagetitle: string

    Returns JQueryPromise<null | false | Revision>

    false if the page doesn't exist, null if the API request failed.

    Requires

    mediawiki.api

  • Initialize a new Wikitext instance by fetching the content of a page.

    Parameters

    • pagetitle: string

    Returns JQueryPromise<null | false | Wikitext>

    false if the page doesn't exist, null if the content of the page failed to be fetched.

    Requires

    mediawiki.api

  • Fetch the wikitext of a page. If additional revision information should be included, use fetch.

    Parameters

    • pagetitle: string

    Returns JQueryPromise<null | string | false>

    false if the page doesn't exist, null if the API request failed.

    Requires

    mediawiki.api

Generated using TypeDoc