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

    Interface ParsedTemplateOutputConfig

    Options for ParsedTemplate.stringify.

    This interface differs from RawTemplateOutputConfig in that the argument of brPredicateTitle is an instance of Title instead of a string.

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

    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: Title) => boolean

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

    Type declaration

      • (title: Title): boolean
      • Parameters

        • title: Title

          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.

    rawTitle?: boolean

    Whether to preserve redundant characters surrounding the title, as found in rawTitle.

    Where possible, use prepend and append instead.

    This option is ignored if such characters interrupt the title itself (e.g., 'F<!---->oo').

    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.