MediaWiki/Variables in templates

Материал из СисадминВики (SysadminWiki.ru)
< MediaWiki(перенаправлено с «MediaWiki/Variables in templates»)
Перейти к: навигация, поиск
Эта страница — перевод страницы MediaWiki/Параметры в шаблонах. Перевод выполнен на 100%.

Другие языки:
English • ‎русский

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

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
 | string = Key1: Value1; Key2: Value2; Key3: Value3
}}

Result:

  • Key1 = Value1
  • Key2 = Value2
  • Key3 = Value3