Jump to content

Module:Sandbox/BrandonXLF/Module:Map params/doc

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by BrandonXLF (talk | contribs) at 06:36, 5 September 2024 (Use {{{i}}} now). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

{{#invoke:Map params|map}} maps parameters received by a function to wikitext using |1= or to a template call using |call=.

Parameters

Input

  • |prefixn= - The prefix of the parameters to process. All registered prefixes will be checked to determine if a number is present in the provided arguments. |prefix1= defaults to processing unnamed parameters.
  • |extran= - An extra parameter to pass to the wikitext or template being called. If the extra parameter is suffixed with a number (same as prefixed parameters but not checked to determine if a number is present), add the suffix (i). For example, style(i).
  • |sparse= - Set to yes to support parameter lists with gaps. Defaults to no.
  • |optnum= - Whether or not to support passing the first parameter without a number, i.e. allow it to be |prefix= rather than |prefix1=. Defaults to yes.

Map to

  • |1= - The wikitext to map parameters to. Parameters are substituted with their number removed, i.e. |itemn= becomes |item= etc. The parameter |i= is replaced with the current index.
  • |call= - Template to call. Parameters are passed with their number removed, i.e. |itemn= becomes |item= etc. The parameter |i= is the current index. Overrides |1=.

Concatenation

  • |sep= - Separator to add between outputs. Outer spaces can be added with {{sp}} or  .
  • |conj= - Special separator to use before the final output.

Advanced

  • |expand= - Whether or not to expand templates, parser functions, extension tags, etc. after substituting parameters. This is most useful when |1= is used without <nowiki>...</nowiki> tags and can provide a slight performance advantage. Only relevant when using |1=. Defaults to yes.

Tests

Basic

{{{@}}}{{{@}}}{{{@}}}

Separator

{{{@}}} + {{{@}}} + {{{@}}}

Conjunction

{{{@}}} + {{{@}}} = {{{@}}}

Start

3 = {{{@}}}, 4 = {{{@}}}, 5 = {{{@}}}

Extra

{{{@}}}i + {{{@}}}i + {{{@}}}i

Sparse

1 = {{{@}}}, 2 = {{{@}}}, 3 = {{{@}}}, 4 = {{{@}}}, 1000 = {{{@}}}

Sparse and start

3 = {{{@}}}, 4 = {{{@}}}, 1000 = {{{@}}}

Prefix

A + B + C

No first number

A + B + C

First number required

Sparse prefix

A + B + C

Sparse no first number

A + B + C

Sparse first number required

B + C

Multiple prefixes

3 (HDR3) = ITM3, 4 = ITM4, 5 (HDR5) = No item, 100 = ITM100

Prefix extra

1 = ITM1, 2 (HDR1) = ITM2

No expand with nowiki

{{2x|{{{@}}}}}{{2x|{{{@}}}}}{{2x|{{{@}}}}}

No expand without nowiki

{{{@}}}{{{@}}}{{{@}}}{{{@}}}{{{@}}}{{{@}}}

Call

AABBCC




Usage

{{#invoke:Sandbox/BrandonXLF/Module:Map params|function_name}}