Module:Loops/doc

Lua module implementing features similar to mw:Extension:Loops, specifically with functionality to parse lists.

Parses a string list using a given delimiter (defaults to %s if not given). The value is then passed into the specified template or formatted according to a given string format pattern.

Transitioning from Extension:Loops
This is documentation on how to transition from using Extension:Loops to Module:Loops to parse lists.

Extension:Loops Syntax

The key variables here are and. These can simply be specified in the module invoke like so:

The rest of the invoke depends on how complex the "do something"/block statement portion is, you can choose to either use a string format (simple output) or template format (more complex output).


 * If your block statement is simple formatting, then use string format output.
 * Because of the order the parser runs statements, some Wikitext may not be compatible with string format. Thus it's recommended for more complex Wikitext use template format instead.
 * If you use  inside your block statement, replace it with a replace string of choice. This should be a unique string pattern, as you don't want to erroneously replace other parts of the format string.
 * If your block statement is more complex, consider moving it into a template which you can then specify with the module invoke.
 * If you use  inside your block statement, replace it with.
 * If you use your index/counter variable in your template code, you can replace it with.

See the parseList examples for sample usages.

Usage

 * Template format


 * String format

Examples

 * Template format


 * String format example #1


 * String format example #2

Returns the number of elements in a string list given a delimiter (defaults to %s if not given).

Duplicates the mw:Extension:Loop function. Output can either be a given template or string format.

Usage

 * String format

Example

 * Template format


 * String format