Jump to content

User:Pee Tern/Sandbox/Template/autonumbered list/doc

From Wikipedia, the free encyclopedia

Function

[edit]

Purpose

[edit]

The {{autonumbered list}} template allows a list of items to be columnated and have a ranking or number scheme automatically calculated; however, it has exceeded template limits for higher item numbers.

For example:

the data in which is produced by:

|#|Biggest Failed Bank Inc.
{{!}} $200,000,000,000
|#|Bigger Failed Bank Pty. Ltd.
{{!}} $20,000,000,000
|#|Big Failed Bank Ltd.
{{!}} $2,000,000,000
|#|Small Failed Bank Pty. Ltd.
{{!}} $100,000,000

The number can be single level, or include sub numbering up to a total of three levels of numbering.

By allowing automatic numbering, editors do not have to adjust the contents of many rows of data when numeric rankings change. The editor can simply add or remove items from the list of items, and the numeric ranking will be automatically recalculated.

One to five columnated fields of data can be included in each list item.

Comparison with "#" wikimarkup

[edit]

While normal wikimarkup using "#"s will number items in a list, wikimarkup does not:

  • prefix parent numbers to sub numbers
  • allow for duplicted rankings to be skipped
  • allow data fields within list items to be columnated

Limitations

[edit]

Number of list items is limited to 50

[edit]

The template can only handle up to 50 list items at one time.

This can be worked around by using the continued and startat parameters in multiple inclusions of the template one exactly below the other on the page.

Parameter use for the continuation work around is:

  • The heading parameters should be used only on the first inclusion.
  • The startat parameter should be used on all but the first inclusion.
  • The continued parameter should be used on all but the last inclusion.
  • Parameters such as numberwidth, columnwidthN, and tablewidth should be set to the same values for all inclusions.
  • The columns parameter can also be used, and should also be kept the same in each inclusion, but readability might be reduced because list items will be columnated within each inclusion, not across all inclusions.

See Continuation from one list to another and Multiple fields examples below.

Number depth is limited to 3

[edit]

The template can only handle up the three levels of numbering, that is:
1
1.1
1.1.1

There is no work around.

Number of columnated fields of data is limited to 5

[edit]

The template can only handle up to five fields of data for each list item.

There is no workaround.

Deficiencies

[edit]

Missing number level flags

[edit]

The template is likely to behave unpredictably if a number level flag is missing, for example, parameter constructs such as:
|#|Stuff
|#.#.#|More stuff

(There is no second level number flag between the first and third level list item.)

or:
|#.#|First list item

(There is no first level number flag before the second level list item.)

Invalid number level flags

[edit]

Unrecognised number level flags are ignored. The corresponding list item will still be displayed, but the automatic numbering behaves as though the list item does not exist.

Usage

[edit]

Caution

[edit]

This template and its sub templates push the wiki functions parser to its limits.

To minimise load on servers, it is best used when there are constant changes to ranked columnated lists, which would require frequent editing and extensive manual adjusting, and edit reviews, of tables.

If a ranking is static, or only ever gets added to at the bottom, then hard coded tables are much more efficient.

Skeleton

[edit]
{{autonumbered list
|columns = 
|halfbackground  = 
|prefix  = 
|suffix  = 
|skip    = 
|numberwidth  = 
|numberheading = 
|tablewidth   = 
|columnwidth1 = 
 (...up to 5...)
|heading1 =
 (...up to 5...)
|startat      = 
|numberflag1
|listitemcontent1
 (...up to 50 pairs of number flag and list item content - unnamed parameters...)
|continued = 
}}

Examples

[edit]

Number, sub number, and sub sub number, in two columns

[edit]

Suffixed numbers

[edit]

Prefixed and suffixed numbers, in four columns

[edit]

Continuation from one list to another

[edit]

Continuation would normally only be used for numbered lists greated than 50 (the template maximum) long. In this case, just for example, the first list only has 10 items in it.

Repeated number entries - repeated numbers not skipped

[edit]

Repeated number entries - repeated numbers skipped

[edit]

Multiple fields

[edit]

Parameters

[edit]

This template uses both named and unnamed parameters.

The number flag and the list item content for each list item are unnammed parameters.

Parameter Name Required Description Values
columns no Number of columns to display the items in. Defaults to 1. Number
halfbackground no If set to any value then every second item line has a background to allow easy eye sighting across the list. Any non blank value.
prefix no Text to appear before the number. Defaults to nothing. Any optionally linked text.
suffix no text to appear after the number. Defaults to nothing. Any optionally linked text.
skip no Set to any value to skip numbers if an item has a duplicate ranking to the previous item. The number is incremented but not displayed. Defaults to no skipping and reuse of the previous number. Any non blank value.
numberwidth no The percentage width to allocate to the list item number within the list item. Defaults to 15. Any number from 0 to 100.
numberheading no The heading to be displayed over the first column, of automatically generated numbers. Almost any wikitext. May include wiki table markup.
tablewidth no The percentage width to allocate to the table relative to the displayed page. Default is to minimise width. Any number from 0 to 100.
columnwidth1 no The percentage width to allocate to each field within the list item if there is more than one field. Columnwidth1 defaults to (100 - numberwidth) if not provided. Can be up to 5 fields. The sum of numberwidth and columnwidth1 through columnwidth5 should be 100. Any number from 0 to 100.
heading1 no The heading to be displayed over each column of fields within the list item. Almost any wikitext. may include wiki table markup, for example align=center {{!}} '''Field Heading'''giving
Field Heading
startat no The start number for the first list item. Is set then causes formatting of the list to allow list to appear as a seemless continuation of a previous list. Defaults to 1 and no continuation formatting of the list. Any number.
numberflag1 no Unnamed parameter. The flag to indicate the level and type of numbering required. Up to 50. Must be paired with listitemcontent1.
Flag Effect
# 1
2
3
etc.
(Parameter value left blank.) Indicates a duplicate ranking or numbering at the # level. Behaviour is defined by the skip parameter.
#.# 1.1
1.2
1.3
etc.
#. Indicates a duplicate ranking or numbering at the #.# level. Behaviour is defined by the skip parameter.
#.#.# 1.1.1
1.1.2
1.1.3
etc.
#.#. Indicates a duplicate ranking or numbering at the #.#.# level. Behaviour is defined by the skip parameter.
Text == one of the 6 flag values.
listitemcontent1 no Unnamed parameter. The content of the list item. Up to 5 fields of data can be provided. To provide more than one field use standard wikitable syntax BUT replace single and double pipes with {{!}} and {{!!}} respectively. Up to 50. If there is more than one field in the list item then columnwidths must be set for each field. Nearly any wikimarked text.
continued no If set to any value then causes the formatting of the list to allow the list to be seemlessly followed by another list.

Notes for template editors

[edit]

Wiki function parser limit

[edit]

This template relies on a subtemplate, {{colevel/count things}}. The {{colevel/count_things}} template reaches one or more nested function depth limits, and is extensively coded to get around this problem. It is probably not viable to increase the number of list items processable by this template unless the {{colevel/count things}} template's algorithm can be completely redesigned to use a much flatter structure.

Structure of template call relationships

[edit]

Sub calls

[edit]
{{autonumbered list}}
{{colevel/headings}} {{colevel/item set}}

Para calls

[edit]
{{colevel/item set}} {{colevel/find last}}
{{autonumbered list/number}} {{colevel/count things}}
{{colevel/column style}}
{{colevel/headings}} {{colevel/column style}}

Reflist

[edit]