Vikipedio:Lua/Moduloj/Listutil/en

El Vikipedio, la libera enciklopedio
Salti al navigilo Salti al serĉilo
Ŝablona programado Diskutoj Lua Testoj Subpaĝoj
Modulo Esperanto English Deutsch

Modulo: Dokumentado

Listutil deals with lists.

Functions for templates[redakti fonton]

list
Is the primary function inside this module; converts a given text according to a delimiter into a list
";" is passed as an argument to the "list" function of the "listutil" Lua module; in this module, the argument is a delimiter and can be any string (for an example, it could be a comma or a period)
"what is this; i don't even" is in the input string, which is then split into pieces based on the delimiter (the input string contains a ";", so that's where the string is split)
ligu with the value jes causes, that the list items are automatically linked with Wiki code.
modo has three possible values: ul, ol and span. If it is ul, then the not numbered list further appears. If it is ol, then a numbered list appears. If it is span, then a real list even not more appears, but a consecutive layout of list items. Besides, then the delimiter can be defined with the parameter limsigno.
limsigno is a helping parameter, which works only, if modo has a the same time the value span. Else it is ignored. Please note, that it isn't identical to the unnamed first parameter. That is the delimiter for split the list items.
linisalto is a helping parameter, which works only, if modo has a the same time the value span. Else it is ignored.
count
Is a function, which returns the number of the list items in dependence of the given delimiter.
category
Is a function, which automatically creates categories from the given list items depending of the delimiter and more parameters. If before the part from the list item of the category has to be more text, then you have to define the parameter kategorio. If after the part from the list item of the category has to be more text, then you have to define the parameter kategorio2. Besides, the sort key of the category can be defined with the parameter ordigilo.

Usage in templates[redakti fonton]

Function list
{{#invoke:listutil|list|;|what is this; i don't even}}

This will output:

  • what is this
  • i don't even
{{#invoke:listutil|list|,|Larry, Curl, Moe}}

This will output:

  • Larry
  • Curl
  • Moe
{{#invoke:listutil|list| .. |1 .. 2 .. 3 .. 4 ..}}

This will output:

  • 1
  • 2
  • 3
  • 4 ..
Function list with parameter ligu
{{#invoke:Listutil|list|,|kato, hundo, muso, ĉevalo|ligu=jes}}

This will output:

{{#invoke:Listutil|list|,|kato, [[hundo]], muso, ĉevalo|ligu=jes}}

This will output:

{{#invoke:Listutil|list|,|kato, [[Hundeto|hundo]], muso, ĉevalo|ligu=jes}}

This will output:

{{#invoke:Listutil|list|,|bela kato, granda hundo, griza muso, rapida ĉevalo|ligu=jes}}

This will output:

{{#invoke:Listutil|list|,|bela [[kato]], granda [[hundo]], griza [[muso]], rapida [[ĉevalo]]|ligu=jes}}

This will output:

Function list with the parameters ligu and modo
{{#invoke:Listutil|list|,|kato, hundo, muso, ĉevalo|ligu=jes|modo=ol}}

This will output:

  1. kato
  2. hundo
  3. muso
  4. ĉevalo
{{#invoke:Listutil|list|,|kato, hundo, muso, ĉevalo|ligu=jes|modo=span}}

This will output: kato · hundo · muso · ĉevalo

Function list with the parameters ligu, modo and limsigno
{{#invoke:Listutil|list|,|kato, hundo, muso, ĉevalo|ligu=jes|modo=span|limsigno=•}}

This will output: kato • hundo • muso • ĉevalo

{{#invoke:Listutil|list|,|kato, hundo, muso, ĉevalo|ligu=jes|modo=span|limsigno=#}}

This will output: kato # hundo # muso # ĉevalo

Function list even work nested
{{#invoke:Listutil|list|,|rabobestoj {{#invoke:Listutil|list|,|kato, hundo}}, muso, ĉevalo}}

This will output:

  • rabobestoj
    • kato
    • hundo
  • muso
  • ĉevalo
Function count
{{#invoke:listutil|count|;|what is this; i don't even}}

This will output:

2

{{#invoke:listutil|count|,|Larry, Curl, Moe}}

This will output:

3

{{#invoke:listutil|count| .. |1 .. 2 .. 3 .. 4 ..}}

This will output:

4


Functions for Lua[redakti fonton]

  • ?

Usage[redakti fonton]

  • General library

Dependencies[redakti fonton]

  • None

Origin[redakti fonton]