Difference between revisions of "Template:List"

From Twinsuniverse
Jump to: navigation, search
(updated documentation)
(added infobox)
Line 5: Line 5:
 
     |{{#if: {{{ {{#var: arg}}|}}}
 
     |{{#if: {{{ {{#var: arg}}|}}}
 
       |<li>{{{ {{#var: arg}}}}}</li>}}}}</{{#ifeq: {{{numeric|false}}}|false|ul|ol}}>}}
 
       |<li>{{{ {{#var: arg}}}}}</li>}}}}</{{#ifeq: {{{numeric|false}}}|false|ul|ol}}>}}
}}</includeonly><noinclude>
+
}}</includeonly><noinclude>{{Infobox Template
 +
|purpose=formatting
 +
|singletag=optional
 +
|multiline=optional
 +
|gamerelated=no
 +
|suppressible=
 +
|choice=
 +
|cat1=
 +
|var1=arg
 +
}}
 +
 
 
This template wraps up to 30 non-empty strings into an (un)ordered list. The list will display the first string as-is if the second is empty, and will not display anything if the first is also empty. This is useful if the strings are yet unknown and only need to be wrapped if there are more than one not empty.
 
This template wraps up to 30 non-empty strings into an (un)ordered list. The list will display the first string as-is if the second is empty, and will not display anything if the first is also empty. This is useful if the strings are yet unknown and only need to be wrapped if there are more than one not empty.
  
Line 57: Line 67:
 
If all strings are empty or no string is specified, all are effectively omitted resulting in no display at all.
 
If all strings are empty or no string is specified, all are effectively omitted resulting in no display at all.
  
[[Category:Formatting Templates]]
 
 
</noinclude>
 
</noinclude>

Revision as of 10:27, 4 June 2014

List
Purpose

Formatting [list all]

Single tag

Optional [list all]

Multi-line

Optional [list all]

Protected

No [list all]

Game related

No [list all]

Categorization
Categories

none [list all]

Variables
Names

One: [list all]

  • arg  (free for reuse)
Subpages

This template wraps up to 30 non-empty strings into an (un)ordered list. The list will display the first string as-is if the second is empty, and will not display anything if the first is also empty. This is useful if the strings are yet unknown and only need to be wrapped if there are more than one not empty.

If the arguments are specified by their position number however, then their position number will instead be taken into account for this mechanic.

Parameters

Thirty unnamed parameters, no parameter name, case sensitive, all default to not displayed.

  • numeric: Whether to render a numeric (ordered) list instead (any value will do, defaults to false)


Note: The unnamed parameters may be specified in any order and allow empty arguments between them, because of all the arguments only non-empty ones have effect.

Syntax

{{list|numeric=yes
 |string one
 |string two
 |string three
 |...
 |string ten
}}

Examples

When specifying only five strings:

{{list
 |Ape
 |Bear
 |Chihuahua
 |Donkey
 |Eel
}}
  • Ape
  • Bear
  • Chihuahua
  • Donkey
  • Eel


If only one string is specified:

{{list|only one string this time}}
only one string this time


If the numeric parameter is specified with a nonempty value (it is ignored when only one list item is specified):

{{list|numeric=yes|only one string this time also}}
{{list|numeric=yes
  |string one
  |and another}}
only one string this time also
  1. string one
  2. and another


If all strings are empty or no string is specified, all are effectively omitted resulting in no display at all.