Jump to content

Module:Params/doc/examples/constructed transclusion/doc

From mediawiki.org

This example template illustrates the capabilities of the reinterpreting function from Module:Params in order to transclude a custom template with custom parameters.

Usage

[edit]
  • {{module:params/doc/examples/constructed transclusion|enum|Jazz//rock//pop//rap}}
    {{enum|Jazz|rock|pop|rap}}
    Lua error: expandTemplate: template "enum" does not exist.
  • {{module:params/doc/examples/constructed transclusion|Pagelist|1 -> X1 // 2 -> X2 // 3 -> X3 // 4 -> X4 // 5 -> X5}}
    {{Pagelist|1=X1|2=X2|3=X3|4=X4|5=X5}}
    X1, X2, X3, X4 and X5
  • {{module:params/doc/examples/constructed transclusion|A note}}
    {{A note}}
    Lua error: expandTemplate: template "A note" does not exist.

Template data

[edit]

This example template transcludes a custom template with custom parsed parameters.

Template parameters

ParameterDescriptionTypeStatus
Template1

Name of the called template

Example
Pagelist
Stringrequired
Parsed parameters2

All parameters to parse

Example
1 -> X1 // 2 -> X2 // 3 -> X3 // 4 -> X4 // 5 -> X5
Stringoptional
Separatorseparator

The string to use as separator between parameters (pass ‘|pasep=yes’ to interpret this as a Lua pattern)

Default
//
Example
{{!}}
Stringoptional
Setter stringsetter

The string to use as value setter (pass ‘|paset=yes’ to interpret this as a Lua pattern)

Default
->
Example
{{=}}
Stringoptional
Trimtrim

Whether to trim leading and trailing spaces; write ‘|trim=none’ or ‘|trim=named’ or ‘|trim=positional’ or ‘|trim=all’; when omitted it defaults to ‘|trim=named’ (which is wikitext's behavior for template parameters)

Default
named
Example
all
Stringoptional
Separator pattern flagpasep

Set this to ‘y’ in order to interpret ‘|separator=’ as a Lua pattern

Default
no
Example
yes
Booleanoptional
Setter pattern flagpaset

Set this to ‘y’ in order to interpret ‘|setter=’ as a Lua pattern

Default
no
Example
yes
Booleanoptional