Template:ListExtract

From Archaelund Wiki
Revision as of 10:04, 30 December 2023 by MikeB (talk | contribs) (Created page with "<onlyinclude><includeonly>{{#switch:{{{3|}}} |Diff = {{#if:{{#explode:{{{1|}}}|;|{{#expr:{{{2|1}}}-1}}}}|{{Difference|{{#explode:{{{1|}}}|;|{{#expr:{{{2|1}}}-1}}}}}}|{{{Blank|}}}}} |#default = {{#if:{{#explode:{{{1|}}}|;|{{#expr:{{{2|1}}}-1}}}}|{{#explode:{{{1|}}}|;|{{#expr:{{{2|1}}}-1}}}}|{{{Blank|}}}}} }}</includeonly></onlyinclude> {{Documentation}} Category:General Templates")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

This template extracts single items from semicolon-separated lists (i.e. "item1; item2; item3; ...").

Usage

{{ListFormat|<semicolon-separated list>|<item index>|<format>|Blank = <text>}}

The numbering of <item index> starts at 1 (not 0). An optional parameter <format> can be specified (see list below), otherwise the item is output as is. Furthermore, an optional parameter Blank can be provided which replaces empty entries in the list by arbitrary <text>.

Format options

FormatDescriptionExample output
DiffFormats numerical entries as a bonus/malus using Template:Difference.+1

View/Edit documentation page