Difference between revisions of "Module:List/doc"

From EUSwiki
Jump to: navigation, search
(Parameters: fix stray li_stylen params)
m (33 revisions imported)
 
(32 intermediate revisions by 10 users not shown)
Line 1: Line 1:
 
{{module rating|beta}}
 
{{module rating|beta}}
 +
{{high-risk|460,000+}}
 +
{{module rating|protected}}
  
This module outputs various kinds of lists. At present, it supports bulleted lists, unbulleted lists, horizontal lists, numbered lists, and horizontal numbered lists.
+
This module outputs various kinds of lists. At present, it supports bulleted lists, unbulleted lists, horizontal lists, ordered lists (numbered or alphabetical), and horizontal ordered lists. It allows for easy css styling of the list or of the individual list items.
  
 
== Usage ==
 
== Usage ==
Line 14: Line 16:
 
<nowiki>{{</nowiki>#invoke:list<nowiki>|</nowiki>''function''
 
<nowiki>{{</nowiki>#invoke:list<nowiki>|</nowiki>''function''
 
<nowiki>|</nowiki>''first item''<nowiki>|</nowiki>''second item''<nowiki>|</nowiki>''third item''<nowiki>|</nowiki>...
 
<nowiki>|</nowiki>''first item''<nowiki>|</nowiki>''second item''<nowiki>|</nowiki>''third item''<nowiki>|</nowiki>...
<nowiki>|class       = </nowiki>''class''
+
<nowiki>|start          = </nowiki>''start number for ordered lists''
<nowiki>|style       = </nowiki>''style''
+
<nowiki>|type            = </nowiki>''type of numbering for ordered lists''
<nowiki>|list_style = </nowiki>''style for the list tag''
+
<nowiki>|list_style_type = </nowiki>''type of marker for ordered lists (uses CSS)''
<nowiki>|item_style = </nowiki>''style for all list item tags''
+
<nowiki>|class           = </nowiki>''class''
<nowiki>|item_style1 = </nowiki>''style for the first list item tag''<nowiki> |item_style2 = </nowiki>''style for the second list item tag''<nowiki> |</nowiki>...
+
<nowiki>|style           = </nowiki>''style''
<nowiki>|start      = </nowiki>''start number for numbered lists''
+
<nowiki>|list_style     = </nowiki>''style for the list''
<nowiki>|type        = </nowiki>''type of numbering for numbered lists''
+
<nowiki>|item_style     = </nowiki>''style for all list items''
 +
<nowiki>|item1_style    = </nowiki>''style for the first list item''<nowiki> |item2_style = </nowiki>''style for the second list item''<nowiki> |</nowiki>...
 +
<nowiki>|item1_value    = </nowiki>''value for the first list item''<nowiki> |item2_value = </nowiki>''value for the second list item''<nowiki> |</nowiki>...
 +
<nowiki>|indent          = </nowiki>''indent for horizontal lists''
 
<nowiki>}}</nowiki>
 
<nowiki>}}</nowiki>
 
}}
 
}}
Line 35: Line 40:
 
! Produces
 
! Produces
 
! Example output
 
! Example output
 +
! Template using the function
 
|-
 
|-
 
| <code>bulleted</code>
 
| <code>bulleted</code>
 
| Bulleted lists
 
| Bulleted lists
 
| {{#invoke:list|bulleted|First item|Second item|Third item}}
 
| {{#invoke:list|bulleted|First item|Second item|Third item}}
 +
| {{tlx|bulleted list}}
 
|-
 
|-
 
| <code>unbulleted</code>
 
| <code>unbulleted</code>
 
| Unbulleted lists
 
| Unbulleted lists
 
| {{#invoke:list|unbulleted|First item|Second item|Third item}}
 
| {{#invoke:list|unbulleted|First item|Second item|Third item}}
 +
| {{tlx|unbulleted list}}
 
|-
 
|-
 
| <code>horizontal</code>
 
| <code>horizontal</code>
 
| Horizontal bulleted lists
 
| Horizontal bulleted lists
 
| {{#invoke:list|horizontal|First item|Second item|Third item}}
 
| {{#invoke:list|horizontal|First item|Second item|Third item}}
 +
| {{tlx|hlist}}
 
|-
 
|-
| <code>numbered</code>
+
| <code>ordered</code>
| Numbered lists
+
| Ordered lists (numbered lists and alphabetical lists)
| {{#invoke:list|numbered|First item|Second item|Third item}}
+
| {{#invoke:list|ordered|First item|Second item|Third item}}
 +
| {{tlx|ordered list}}
 
|-
 
|-
| <code>horizontal_numbered</code>
+
| <code>horizontal_ordered</code>
| Horizontal numbered lists
+
| Horizontal ordered lists
| {{#invoke:list|horizontal_numbered|First item|Second item|Third item}}
+
| {{#invoke:list|horizontal_ordered|First item|Second item|Third item}}
 +
|
 
|}
 
|}
  
Line 60: Line 71:
  
 
* Positional parameters (<code>1</code>, <code>2</code>, <code>3</code>...) - these are the list items. If no list items are present, the module will output nothing.
 
* Positional parameters (<code>1</code>, <code>2</code>, <code>3</code>...) - these are the list items. If no list items are present, the module will output nothing.
 +
* <code>start</code> - sets the start item for ordered lists. This can be a start number for numbered lists, or a start letter for alphabetical lists. Horizontal ordered lists only support numbers.
 +
* <code>type</code> - the type of marker used in ordered lists. Possible values are "1" for numbers (the default), "A" for uppercase letters, "a" for lowercase letters, "I" for uppercase [[Roman numerals]], and "i" for lowercase Roman numerals. Not supported in horizontal ordered lists. See also the <code>list_style_type</code> parameter.
 +
* <code>list_style_type</code> - the type of marker used in ordered lists. This uses CSS styling, and has more types available than the <code>type</code> parameter, which uses an [[html attribute]]. Possible values are listed at [https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-type MDN's list-style-type page]. Support may vary by browser. <code>list-style-type</code> is an alias for this parameter.
 
* <code>class</code> - a custom class for the {{tag|div}} tags surrounding the list, e.g. <code>plainlinks</code>.
 
* <code>class</code> - a custom class for the {{tag|div}} tags surrounding the list, e.g. <code>plainlinks</code>.
 
* <code>style</code> - a custom css style for the {{tag|div}} tags surrounding the list, e.g. <code>font-size: 90%;</code>.
 
* <code>style</code> - a custom css style for the {{tag|div}} tags surrounding the list, e.g. <code>font-size: 90%;</code>.
* <code>list_style</code> - a custom css style for the list itself. The format is the same as for the {{para|style}} parameter. <code>ul_style</code> is an alias for this parameter, included for backwards compatibility.
+
* <code>list_style</code> - a custom css style for the list itself. The format is the same as for the {{para|style}} parameter.
* <code>item_style</code> - a custom css style for all of the list items (the {{tag|li}} tags). The format is the same as for the {{para|style}} parameter. <code>li_style</code> is an alias for this parameter, included for backwards compatibility.
+
* <code>item_style</code> - a custom css style for all of the list items (the {{tag|li}} tags). The format is the same as for the {{para|style}} parameter.
* <code>item_style1</code>, <code>item_style2</code>, <code>item_style3</code>... - custom css styles for each of the list items. The format is the same as for the {{para|style}} parameter. The <code>li_style1</code>, <code>li_style2</code> <code>li_style3</code> ... parameters are aliases for these parameters, included for backwards compatibility.
+
* <code>item1_style</code>, <code>item2_style</code>, <code>item3_style</code>... - custom css styles for each of the list items. The format is the same as for the {{para|style}} parameter.
* <code>indent</code> - this parameter indents the list, for horizontal and horizontal numbered lists only. The value must be a number, e.g. <code>2</code>. The indent is calculated in [[Em (typography)|em]], and is 1.6 times the value specified. If no indent is specified, the default is zero.
+
* <code>item1_value</code>, <code>item2_value</code>, <code>item3_value</code>... - custom value for the given list item. List items following the one given will increment from the specified value. The value should be a positive integer. (Note that this option only has an effect on ordered lists.)
* <code>start</code> - sets the start number for numbered lists. This is also supported in theory for horizontal numbered lists, but in practice, as of November 2013, this does not work due to lack of browswer support.
+
* <code>indent</code> - this parameter indents the list, for horizontal and horizontal ordered lists only. The value must be a number, e.g. <code>2</code>. The indent is calculated in [[Em (typography)|em]], and is 1.6 times the value specified. If no indent is specified, the default is zero.
* <code>type</code> - the type of numbering for numbered lists. Possible values are "1" for numbers (the default), "A" for uppercase letters, "a" for lowercase letters, "I" for uppercase [[Roman numerals]], and "i" for lowercase Roman numerals. This is also supported in theory for horizontal numbered lists, but in practice, as of November 2013, this does not work due to lack of browswer support.
 
  
 
== Examples ==
 
== Examples ==
 +
 +
; Bulleted lists
 +
 +
{| class="wikitable"
 +
! Code !! Result
 +
|-
 +
| <code><nowiki>{{#invoke:list|bulleted|First item|Second item|Third item}}</nowiki></code>
 +
| {{#invoke:list|bulleted|First item|Second item|Third item}}
 +
|-
 +
| <code><nowiki>{{#invoke:list|bulleted|First item|Second item|Third item|item_style=color:blue;}}</nowiki></code>
 +
| {{#invoke:list|bulleted|First item|Second item|Third item|item_style=color:blue;}}
 +
|-
 +
| <code><nowiki>{{#invoke:list|bulleted|First item|Second item|Third item|item1_style=background-color:yellow;|item2_style=background-color:silver;}}</nowiki></code>
 +
| {{#invoke:list|bulleted|First item|Second item|Third item|item1_style=background-color:yellow;|item2_style=background-color:silver;}}
 +
|}
  
 
; Unbulleted lists
 
; Unbulleted lists
Line 76: Line 104:
 
! Code !! Result
 
! Code !! Result
 
|-
 
|-
| <code><nowiki>{{#invoke:unbulleted list|unbulleted|entry1|entry2|entry3|entry4|entry5|entry6|entry7|entry8|entry9}}</nowiki></code>
+
| <code><nowiki>{{#invoke:list|unbulleted|First item|Second item|Third item}}</nowiki></code>
| {{#invoke:unbulleted list|unbulleted|entry1|entry2|entry3|entry4|entry5|entry6|entry7|entry8|entry9}}
+
| {{#invoke:list|unbulleted|First item|Second item|Third item}}
 
|-
 
|-
| <code><nowiki>{{#invoke:unbulleted list|unbulleted|Winner|Runner-up|Third place|li_style=color:blue;}}</nowiki></code>
+
| <code><nowiki>{{#invoke:list|unbulleted|First item|Second item|Third item|item_style=color:blue;}}</nowiki></code>
| {{#invoke:unbulleted list|unbulleted|Winner|Runner-up|Third place|li_style=color:blue;}}
+
| {{#invoke:list|unbulleted|First item|Second item|Third item|item_style=color:blue;}}
 
|-
 
|-
| <code><nowiki>{{#invoke:unbulleted list|unbulleted|Winner|Runner-up|Third place|li_style1=background-color:yellow;|li_style2=background-color:silver;}}</nowiki></code>
+
| <code><nowiki>{{#invoke:list|unbulleted|First item|Second item|Third item|item1_style=background-color:yellow;|item2_style=background-color:silver;}}</nowiki></code>
| {{#invoke:unbulleted list|unbulleted|Winner|Runner-up|Third place|li_style1=background-color:yellow;|li_style2=background-color:silver;}}
+
| {{#invoke:list|unbulleted|First item|Second item|Third item|item1_style=background-color:yellow;|item2_style=background-color:silver;}}
 
|}
 
|}
  
Line 91: Line 119:
 
! Code !! Result
 
! Code !! Result
 
|-
 
|-
| <code><nowiki>{{#invoke:unbulleted list|hlist|entry1|entry2|entry3|entry4|entry5|entry6|entry7|entry8|entry9}}</nowiki></code>
+
| <code><nowiki>{{#invoke:list|horizontal|First item|Second item|Third item}}</nowiki></code>
| {{#invoke:unbulleted list|hlist|entry1|entry2|entry3|entry4|entry5|entry6|entry7|entry8|entry9}}
+
| {{#invoke:list|horizontal|First item|Second item|Third item}}
 +
|-
 +
| <code><nowiki>{{#invoke:list|horizontal|First item|Second item|Third item|indent=2}}</nowiki></code>
 +
| {{#invoke:list|horizontal|First item|Second item|Third item|indent=2}}
 +
|}
 +
 
 +
; Unbulleted lists
 +
 
 +
{| class="wikitable"
 +
! Code !! Result
 
|-
 
|-
| <code><nowiki>{{#invoke:unbulleted list|hlist|Winner|Runner-up|Third place|li_style=color:blue;}}</nowiki></code>
+
| <code><nowiki>{{#invoke:list|unbulleted|First item|Second item|Third item}}</nowiki></code>
| {{#invoke:unbulleted list|hlist|Winner|Runner-up|Third place|li_style=color:blue;}}
+
| {{#invoke:list|unbulleted|First item|Second item|Third item}}
 
|-
 
|-
| <code><nowiki>{{#invoke:unbulleted list|hlist|Winner|Runner-up|Third place|li_style=color:blue;|indent=2}}</nowiki></code>
+
| <code><nowiki>{{#invoke:list|unbulleted|First item|Second item|Third item|item_style=color:blue;}}</nowiki></code>
| {{#invoke:unbulleted list|hlist|Winner|Runner-up|Third place|li_style=color:blue;|indent=2}}
+
| {{#invoke:list|unbulleted|First item|Second item|Third item|item_style=color:blue;}}
 
|-
 
|-
| <code><nowiki>{{#invoke:unbulleted list|hlist|Winner|Runner-up|Third place|li_style1=background-color:yellow;|li_style2=background-color:silver;}}</nowiki></code>
+
| <code><nowiki>{{#invoke:list|unbulleted|First item|Second item|Third item|item1_style=background-color:yellow;|item2_style=background-color:silver;}}</nowiki></code>
| {{#invoke:unbulleted list|hlist|Winner|Runner-up|Third place|li_style1=background-color:yellow;|li_style2=background-color:silver;}}
+
| {{#invoke:list|unbulleted|First item|Second item|Third item|item1_style=background-color:yellow;|item2_style=background-color:silver;}}
 
|}
 
|}
 +
 +
; Ordered lists
 +
 +
{| class="wikitable"
 +
! Code !! Result
 +
|-
 +
| <code><nowiki>{{#invoke:list|ordered|First item|Second item|Third item}}</nowiki></code>
 +
| {{#invoke:list|ordered|First item|Second item|Third item}}
 +
|-
 +
| <code><nowiki>{{#invoke:list|ordered|First item|Second item|Third item|start=3}}</nowiki></code>
 +
| {{#invoke:list|ordered|First item|Second item|Third item|start=3}}
 +
|-
 +
| <code><nowiki>{{#invoke:list|ordered|First item|Second item|Third item|type=i}</nowiki></code>
 +
| {{#invoke:list|ordered|First item|Second item|Third item|type=i}}
 +
|-
 +
| <code><nowiki>{{#invoke:list|ordered|First item|Second item|Third item|list_style_type=lower-greek}}</nowiki></code>
 +
| {{#invoke:list|ordered|First item|Second item|Third item|list_style_type=lower-greek}}
 +
|}
 +
 +
; Horizontal ordered lists
 +
 +
{| class="wikitable"
 +
! Code !! Result
 +
|-
 +
| <code><nowiki>{{#invoke:list|horizontal_ordered|First item|Second item|Third item}}</nowiki></code>
 +
| {{#invoke:list|horizontal_ordered|First item|Second item|Third item}}
 +
|-
 +
| <code><nowiki>{{#invoke:list|horizontal_ordered|First item|Second item|Third item|start=3}}</nowiki></code>
 +
| {{#invoke:list|horizontal_ordered|First item|Second item|Third item|start=3}}
 +
|-
 +
| <code><nowiki>{{#invoke:list|horizontal_ordered|First item|Second item|Third item|indent=2}}</nowiki></code>
 +
| {{#invoke:list|horizontal_ordered|First item|Second item|Third item|indent=2}}
 +
|}
 +
 +
== Tracking/maintenance category ==
 +
* {{clc|List templates with deprecated parameters}}
 +
 +
== See also ==
 +
* [[Module:Separated entries]]
 +
 +
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
 +
<!-- Categories below this line, please; interwikis at Wikidata -->
 +
[[Category:Modules that add a tracking category]]
 +
}}</includeonly>

Latest revision as of 08:57, 9 May 2018

Lua error in package.lua at line 80: module 'Module:Transclusion_count/data/L' not found.

This module outputs various kinds of lists. At present, it supports bulleted lists, unbulleted lists, horizontal lists, ordered lists (numbered or alphabetical), and horizontal ordered lists. It allows for easy css styling of the list or of the individual list items.

Usage

Quick usage
{{#invoke:list|function|first item|second item|third item|...}}
All parameters
{{#invoke:list|function
|first item|second item|third item|...
|start           = start number for ordered lists
|type            = type of numbering for ordered lists
|list_style_type = type of marker for ordered lists (uses CSS)
|class           = class
|style           = style
|list_style      = style for the list
|item_style      = style for all list items
|item1_style     = style for the first list item |item2_style = style for the second list item |...
|item1_value     = value for the first list item |item2_value = value for the second list item |...
|indent          = indent for horizontal lists
}}
Arguments passed from parent template
{{#invoke:list|function}}
Functions
Function name Produces Example output Template using the function
bulleted Bulleted lists
  • First item
  • Second item
  • Third item
{{bulleted list}}
unbulleted Unbulleted lists
  • First item
  • Second item
  • Third item
{{unbulleted list}}
horizontal Horizontal bulleted lists
  • First item
  • Second item
  • Third item
{{hlist}}
ordered Ordered lists (numbered lists and alphabetical lists)
  1. First item
  2. Second item
  3. Third item
{{ordered list}}
horizontal_ordered Horizontal ordered lists
  1. First item
  2. Second item
  3. Third item

Parameters

  • Positional parameters (1, 2, 3...) - these are the list items. If no list items are present, the module will output nothing.
  • start - sets the start item for ordered lists. This can be a start number for numbered lists, or a start letter for alphabetical lists. Horizontal ordered lists only support numbers.
  • type - the type of marker used in ordered lists. Possible values are "1" for numbers (the default), "A" for uppercase letters, "a" for lowercase letters, "I" for uppercase Roman numerals, and "i" for lowercase Roman numerals. Not supported in horizontal ordered lists. See also the list_style_type parameter.
  • list_style_type - the type of marker used in ordered lists. This uses CSS styling, and has more types available than the type parameter, which uses an html attribute. Possible values are listed at MDN's list-style-type page. Support may vary by browser. list-style-type is an alias for this parameter.
  • class - a custom class for the <div>...</div> tags surrounding the list, e.g. plainlinks.
  • style - a custom css style for the <div>...</div> tags surrounding the list, e.g. font-size: 90%;.
  • list_style - a custom css style for the list itself. The format is the same as for the |style= parameter.
  • item_style - a custom css style for all of the list items (the <li>...</li> tags). The format is the same as for the |style= parameter.
  • item1_style, item2_style, item3_style... - custom css styles for each of the list items. The format is the same as for the |style= parameter.
  • item1_value, item2_value, item3_value... - custom value for the given list item. List items following the one given will increment from the specified value. The value should be a positive integer. (Note that this option only has an effect on ordered lists.)
  • indent - this parameter indents the list, for horizontal and horizontal ordered lists only. The value must be a number, e.g. 2. The indent is calculated in em, and is 1.6 times the value specified. If no indent is specified, the default is zero.

Examples

Bulleted lists
Code Result
{{#invoke:list|bulleted|First item|Second item|Third item}}
  • First item
  • Second item
  • Third item
{{#invoke:list|bulleted|First item|Second item|Third item|item_style=color:blue;}}
  • First item
  • Second item
  • Third item
{{#invoke:list|bulleted|First item|Second item|Third item|item1_style=background-color:yellow;|item2_style=background-color:silver;}}
  • First item
  • Second item
  • Third item
Unbulleted lists
Code Result
{{#invoke:list|unbulleted|First item|Second item|Third item}}
  • First item
  • Second item
  • Third item
{{#invoke:list|unbulleted|First item|Second item|Third item|item_style=color:blue;}}
  • First item
  • Second item
  • Third item
{{#invoke:list|unbulleted|First item|Second item|Third item|item1_style=background-color:yellow;|item2_style=background-color:silver;}}
  • First item
  • Second item
  • Third item
Horizontal lists
Code Result
{{#invoke:list|horizontal|First item|Second item|Third item}}
  • First item
  • Second item
  • Third item
{{#invoke:list|horizontal|First item|Second item|Third item|indent=2}}
  • First item
  • Second item
  • Third item
Unbulleted lists
Code Result
{{#invoke:list|unbulleted|First item|Second item|Third item}}
  • First item
  • Second item
  • Third item
{{#invoke:list|unbulleted|First item|Second item|Third item|item_style=color:blue;}}
  • First item
  • Second item
  • Third item
{{#invoke:list|unbulleted|First item|Second item|Third item|item1_style=background-color:yellow;|item2_style=background-color:silver;}}
  • First item
  • Second item
  • Third item
Ordered lists
Code Result
{{#invoke:list|ordered|First item|Second item|Third item}}
  1. First item
  2. Second item
  3. Third item
{{#invoke:list|ordered|First item|Second item|Third item|start=3}}
  1. First item
  2. Second item
  3. Third item
{{#invoke:list|ordered|First item|Second item|Third item|type=i}
  1. First item
  2. Second item
  3. Third item
{{#invoke:list|ordered|First item|Second item|Third item|list_style_type=lower-greek}}
  1. First item
  2. Second item
  3. Third item
Horizontal ordered lists
Code Result
{{#invoke:list|horizontal_ordered|First item|Second item|Third item}}
  1. First item
  2. Second item
  3. Third item
{{#invoke:list|horizontal_ordered|First item|Second item|Third item|start=3}}
  1. First item
  2. Second item
  3. Third item
{{#invoke:list|horizontal_ordered|First item|Second item|Third item|indent=2}}
  1. First item
  2. Second item
  3. Third item

Tracking/maintenance category

See also