Module:Sports table/Custom/doc explained

This style for Lua-based is meant to build group and league tables for competitions with various formats. Unlike other styles for the Sports table module, this style does not calculate values other than the number of games played and a simple calculation for points. If you need other calculations or if you are creating a table for a competition in a sport with a sport specific style, consider using another style. The purpose of the Custom style is to allow a custom configuration of any columns that you intend to use. This documentation explains how to use this module with the Custom style in an article or template, check the table of contents for specific items.

Usage

Basic usage

In its simplest form only several parameters need to be used to build a table.

What you type
What it looks like

The main command is the <nowiki>{{#invoke:Sports table|main|style=Custom}}</nowiki> statement which basically calls the module and enables you to set everything up. You also need to set the parameter to determine how many columns will be displayed after the team column. If this is not set, then there will be one column after the team column.For each column you now define the column style and/or column header by using and respectively (with N replaced by the column number). For more information on column styles, see

  1. Column styles
. To set the order and number of rows, you list the positions of the teams as,, etc for however many teams you need in the table. You can use full team names there without spaces if you want, but using codes (as in the example) can make it easier. For each team you now define the wins, draws, losses, and values contained in column number N by using,, and respectively (with TTT replaced by the team code). If you do not define these numbers, it is automatically assumed to be &amp;nbsp;&amp;nbsp;, except for columns which use a column style or have defined . It is good practice though to include them anyway and to align the columns using appropriate spaces (as in the example), so the code is easy to read. The last step now is to define the parameters which determine what name is shown in the table, you can use wiki markup and templates in here as well. See
  1. Dating
to see how to change the update date.

Ranking column

One of the columns should always be a ranking column. This column may be chosen by a parameter.

What you type
What it looks like
The parameter selects which parameter is the ranking column. This column will be bolded and any head-to-head notes will be applied to the content of cells in this column. See
  1. Notes
for more information on head-to-head notes. By default, the ranking column is the last column. If you do not want any column to be the ranking column, use . Note that in this case you should not define any head-to-head notes, because they will not be displayed.

Column styles

It is very useful to set column styles in these tables

What you type
What it looks like
Note that in this table, even though an Em-dash is not displayed when draw data is not given. This is because the default value set by the column style supersedes any manually entered default value. However column 6 shows that data entered manually via supersedes the column style data.This example shows multiple relevant column styles

pld, played, match, or matches

If the column style is set to one of these values, then the default value of a cell is calculated by adding up plus plus, each of whose default values are 0.The column header is <abbr title="Played">Pld</abbr>, but may be changed using .

w, win, or wins

If the column style is set to one of these values, then the default value of a cell is the value of or 0 if no such value is given.The column header is <abbr title="Won">W</abbr>.

d, draw, or draws

If the column style is set to one of these values, then the default value of a cell is the value of or 0 if no such value is given.The column header is <abbr title="Drawn">D</abbr>. For backwards compatibility with the WDL style, if is set to yes, then the header is <abbr title="Tied">T</abbr>, and in either case, the header may be changed using

l, loss, or losses

If the column style is set to one of these values, then the default value of a cell is the value of or 0 if no such value is given.The column header is <abbr title="Lost">L</abbr>.

rw

For backwards compatibility with the WDL style, there is an option for a rounds won column style.If the column style is set to this value, then the default value of a cell is the value of or 0 if no such value is given.The column header is <abbr title="Rounds won">RW</abbr>, but may be changed using .

pts or points

If the column style is set to one of these values, then the default value of a cell is the number of points obtained by adding up the appropriate values for the wins, draws, losses, and rounds won.As a default a win is worth 3 points, a draw 1 point, a loss 0 points, and a round won 1 point. These values can be overwritten to what you need by,, and .The column header is <abbr title="Points">Pts</abbr>.

ppg

If the column style is set to this value, then the default value of a cell is the points as calculated above divided by the number of matches as calculated above. Even if these values have been overridden by, the calculated value is used and not the input value.The column header is <abbr title="Points per game">PPG</abbr>.A column with the ppg style will be slightly wider than the default column width.

ppga

It means "ppg average"; same as ppg but the value gives three decimal places.

sum_S_T or diff_S_T

If the column style is set to one of these values, with S and T replaced by non-mathematical column styles, then the value of a cell will be the mathematical result of the chosen operation on the values determined by the column styles specified by S and T.Note that if entries for S or T are not defined, then a default value of 0 is set, even if they are present in a column with a different default value.A mathematical style does not alter the column header from the default.The parameter determines whether a plus sign is shown on differences that are positive. By default this value is set to .

other

Any other column style will not set a default value, and so the default cell value set by will be used.If the column style is set to such a value other than those listed above which is at most 3 characters long, then the column header is a fully uppercase version of the column style. For example, if the column style is set to cs, then the column header is CS.However, if the column style is set to a value other than those listed above that is longer than 3 characters, no alteration to the header will be made. For example, if the 2nd column style is set to cscs, then the column header is <abbr title="Column 2">2</abbr>.Additionally, if the column style is set to a value other than those listed above, then input may be taken from a parameter given by the column style underscore TTT. For example, if the column style is set to cs, then input may be taken via in addition to the usual .Currently, custom column styles should only contain alphanumeric characters. The results of anything else are undefined.

Default styles

If you wish to set the column style of multiple columns at once to imitate a different style of the Sports table module, then this may be done using the parameter.

What you type
What it looks like
For backwards compatibility with the WDL style, there are many choices for which produce similar columns to those in the WDL style. Valid choices for this parameter are shown below.If the parameter is set, this parameter will take precedence over the number of columns given by the default style.If no is defined, then the ranking column will be set equal to the pts column.Note that a column style set using takes precedence over the column style set by .For backwards compatibility with the WDL style, if using one of these default styles, then parameters,,, and may be used to remove some of these columns, and alter the number of columns accordingly.Additionally, to list losses first, use or .

WDLbasic

Column styles are (in order): pld, win, draw, loss, pts

WLbasic

Column styles are (in order): pld, win, loss, pts

WDLgdiff

Column styles are (in order): pld, win, draw, loss, gf, ga, diff_gf_ga, pts

WLgdiff

Column styles are (in order): pld, win, loss, gf, ga, diff_gf_ga, pts

Customization

Several things can be customized in these tables

Bolded columns

Normally, only the ranking column has bolded entries. This may be customized.

What you type
What it looks like
You can set all entries of column number N to be bolded by using . Note that if a column style sets a column to be bolded, then there is no way to set that column to a normal font weight.

Column alignment

Normally the data in any column (other than the team name column) is placed in the center of the column. This may be customized.

What you type
What it looks like
You can choose the text alignment of column number N by using . Note that the column header is always centered.

Header options

What you type
What it looks like
The wording of the Team column can be adjusted using . Similarly, the wording of any given custom column number N can be adjusted by and this wording is used instead of any wording set by a column style.