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

    Interface TemplateOutputConfig<T>

    Options for Template.stringify.

    interface TemplateOutputConfig<T> {
        append?: string;
        brPredicateParam?: (param: TemplateParameter) => boolean;
        brPredicateTitle?: (title: T) => boolean;
        prepend?: string;
        sortPredicate?: (
            obj1: TemplateParameter,
            obj2: TemplateParameter,
        ) => number;
        suppressKeys?: string[];
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    append?: string

    Optional text to add after the template title.

    brPredicateParam?: (param: TemplateParameter) => boolean

    A predicate function to determine whether there should be a line break after each template parameter.

    This predicate is called on every parameter if provided. If sortPredicate is also provided, the predicate is evaluated against the reordered array.

    Type declaration

    brPredicateTitle?: (title: T) => boolean

    A predicate function to determine whether there should be a line break after the title.

    Type declaration

      • (title: T): boolean
      • Parameters

        • title: T

          A Title instance for a well-formed template, or a string for an ill-formed template.

        Returns boolean

        true to add a trailing line break, or false otherwise.

    prepend?: string

    Optional text to add before the template title (e.g., subst:).

    If this would end up in a double colon before the template title, it will be automatically sanitized to a single colon.

    sortPredicate?: (obj1: TemplateParameter, obj2: TemplateParameter) => number

    Callback function to Array.prototype.sort, called on an array-cast Template.params before stringifying the template parameters.

    suppressKeys?: string[]

    By default, stringify() outputs all numeric keys (e.g., '1='), unless they were registered without an explicit key and were internally assigned numeric keys. However, it is best practice to explicitly name all keys when registering parameters via Template.insertParam, to avoid unintentionally assigning different numeric keys.

    In such cases, you can use this option to suppress specific numeric keys from the output by providing an array of keys (e.g., { suppressKeys: ['1'] }). The specified keys will be excluded from the result.

    Note that this option has no effect if a parameter value contains an '='. To ensure correct rendering, mwbot-ts will always include the key for such parameters.