mwbot-ts - v1.2.7
    Preparing search index...

    Interface ParsedFileWikilink

    The instance members of the ParsedFileWikilink class. For static members, see ParsedFileWikilinkStatic (defined separately due to TypeScript limitations).

    interface ParsedFileWikilink {
        children: Set<number>;
        endIndex: number;
        index: number;
        nestLevel: number;
        params: string[];
        parent: null | number;
        rawTitle: string;
        skip: boolean;
        startIndex: number;
        text: string;
        title: Title;
        addParam(param: string): this;
        deleteParam(index: number, leftShift?: boolean): boolean;
        getParam(index: number): null | string;
        hasParam(index: number, value?: string | RegExp): boolean;
        hasParam(predicate: (index: number, value: string) => boolean): boolean;
        setParam(
            param: string,
            index: number,
            options?: { ifexist?: boolean; overwrite?: boolean },
        ): boolean;
        setTitle(title: string | Title, verbose?: boolean): boolean;
        stringify(options?: ParsedFileWikilinkOutputConfig): string;
        toString(): string;
        toWikilink(title: string | Title, verbose?: boolean): null | ParsedWikilink;
    }

    Hierarchy (View Summary)

    Index

    Properties

    children: Set<number>

    The indices of the child objects within the parseWikilinks result array.

    endIndex: number

    The ending index of this wikilink in the wikitext (exclusive).

    index: number

    The index of this object within the result array returned by parseWikilinks.

    nestLevel: number

    The nesting level of this wikilink. 0 if it is not nested within another wikilink.

    A value of 1 or greater indicates that the wikilink is either incorrectly embedded within another wikilink, or that it serves as part of the thumb text of a file wikilink.

    params: string[]

    Parameters of the instance. These are not automatically trimmed of leading and trailing whitespace.

    parent: null | number

    The index of the parent object within the parseWikilinks result array, or null if there is no parent.

    rawTitle: string

    The raw wikilink title, as directly parsed from the left part of a [[wikilink|...]] expression.

    skip: boolean

    Whether the wikilink appears inside an HTML tag specified in SkipTags.

    startIndex: number

    The starting index of this wikilink in the wikitext.

    text: string

    The original text of the wikilink parsed from the wikitext. The value of this property is static.

    title: Title

    The title of the file that the wikilink transcludes.

    This property is read-only. To update it, use setTitle.

    Methods

    • Deletes a parameter.

      Parameters

      • index: number

        The parameter index to delete.

      • leftShift: boolean = true

        Whether to shift the remaining parameters to the left after deletion. (Default: true)

      Returns boolean

      true if the parameter was deleted, otherwise false.

    • Gets a parameter at the given index.

      Parameters

      • index: number

        The index of the parameter to retrieve.

      Returns null | string

      The parameter value, or null if no value is found at the specified index.

    • Checks if a parameter at the specified index exists, optionally matching its value.

      Parameters

      • index: number

        The parameter index to match.

      • Optionalvalue: string | RegExp

        The optional value matcher.

        • If a string, checks for an exact value match.
        • If a regular expression, tests the parameter value against the pattern.
        • If omitted, only the parameter index is checked.

      Returns boolean

      true if a matching parameter exists; otherwise, false.

    • Checks if a parameter exists based on a custom predicate function.

      Parameters

      • predicate: (index: number, value: string) => boolean

        A function that tests each parameter.

      Returns boolean

      true if a matching parameter exists; otherwise, false.

    • Sets a parameter at the given index.

      Parameters

      • param: string

        The new parameter.

      • index: number

        The index of the parameter to update.

      • options: { ifexist?: boolean; overwrite?: boolean } = {}

        Options to set the new parameter.

        • Optionalifexist?: boolean

          Whether to set the parameter only if a parameter is already set at the specified index.

        • Optionaloverwrite?: boolean

          Whether to overwrite existing parameters. If false, the new parameter is not registered if there is an existing parameter at the specified index. (Default: true)

      Returns boolean

      A boolean indicating whether the new parameter has been set.

    • Sets a new file title to the instance.

      A non-file title is not allowed as the title argument. For 'File:...' titles (without a leading colon), use toWikilink instead.

      Parameters

      • title: string | Title

        The new file title to set.

      • Optionalverbose: boolean

        Whether to log errors. (Default: false)

      Returns boolean

      A boolean indicating whether the new title was set.