Module:ArrayParameter/doc

From Puella Magi Wiki
Jump to navigation Jump to search

This is the documentation page for Module:ArrayParameter

This module enables a template to handle multiple "array-like" parameters. It defines an "array-like" as any set of parameters that consist of a common prefix followed by a number. The numbers must be sequential, or the module will raise an error.

The module takes every matching parameter, substitutes its value into a template, and concatenates the result together.

Usage: {{#invoke|ArrayParameter|main|name=...|...}}

The following parameters are supported:

  • name – The name of the array-like parameter. If name=char, then the module looks for template parameters called char_n where n is any positive integer. Defaults to arg if not specified.
  • separator – A string used as a separator when concatenating. Defaults to an empty string if not specified.
  • first, last – If specified, the transformation is limited to the subsequence of parameters with the indicated indices. A negative index counts from the end. For example, if you pass name=value, first=3, and last=-2, and there are 10 parameters passed to the template, then only the parameters from value_3 to value_9 are formatted and concatenated.
  • template or unnamed parameter – The template to substitute the values into. The string %s will be replaced with the values of the parameters.