MediaWiki/Variables in templates
Creating list
In order to create a list from from the passed string as a variable we need an additional template, which will split the string onto several values.
List out of string with one delimiter
There is an example of building simple list with one delimiter (;), using parser function #arraymap. It uses one template
- {{Create list}}
We can skip using template and put its code directly to text, if we are not going to use such a list format anywhere else.
{{Create list | string = Key1: Value1; Key2: Value2; Key3: Value3 }}
Result:
- Key1: Value1
- Key2: Value2
- Key3: Value3
List out of string with two delimiters
There is an example of building complex list with two delimiters: (;) and (:), using parser functions #arraymap and #explode. It uses two templates:
- {{Create double list}}
- {{Create list item}}
{{Create double list | string = Key1: Value1; Key2: Value2; Key3: Value3 }}
Result:
- Key1 = Value1
- Key2 = Value2
- Key3 = Value3