Module:Sports table/Custom/doc

This style for Lua-based Module:Sports table 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.

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

The main command is the  statement which basically calls the module and enables you to set everything up. You also need to set the num_cols 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 colstyleN and col_headerN respectively (with N replaced by the column number). For more information on column styles, see. To set the order and number of rows, you list the positions of the teams as team1, team2, 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 win_TTT, draw_TTT, loss_TTT and colN_TTT respectively (with TTT replaced by the team code). If you do not define these numbers, it is automatically assumed to be, except for columns which use a column style or have defined default_valueN. 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 name_TTT parameters which determine what name is shown in the table, you can use wiki markup and templates in here as well. See 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. The ranking_col 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 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 0. 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 Note that in this table, even though &amp;mdash; 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 col6_TTT 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 win_TTT plus draw_TTT plus loss_TTT, each of whose default values are 0. The column header is, but may be changed using pld_header.

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 win_TTT or 0 if no such value is given. The column header is.

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 draw_TTT or 0 if no such value is given. The column header is. For backwards compatibility with the WDL style, if use_tie is set to yes, then the header is, and in either case, the header may be changed using draw_header

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 loss_TTT or 0 if no such value is given. The column header is.

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 rw_TTT or 0 if no such value is given. The column header is, but may be changed using rw_header.

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 winpoints, drawpoints, losspoints and rwpoints. The column header is.

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 colN_TTT, the calculated value is used and not the input value. The column header is. 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 plus_sign_diffs determines whether a plus sign is shown on differences that are positive. By default this value is set to no.

other
Any other column style will not set a default value, and so the default cell value set by default_valueN 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. 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. 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 cs_TTT in addition to the usual colN_TTT. 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 default_style parameter. For backwards compatibility with the WDL style, there are many choices for default_style which produce similar columns to those in the WDL style. Valid choices for this parameter are shown below. If the parameter num_cols is set, this parameter will take precedence over the number of columns given by the default style. If no ranking_col is defined, then the ranking column will be set equal to the pts column. Note that a column style set using colstyleN takes precedence over the column style set by default_style. For backwards compatibility with the WDL style, if using one of these default styles, then parameters show_win, show_draw, show_loss, and hide_played may be used to remove some of these columns, and alter the number of columns accordingly. Additionally, to list losses first, use true or true.

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. You can set all entries of column number N to be bolded by using yes. 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. You can choose the text alignment of column number N by using aligncolN. Note that the column header is always centered.

Header options
The wording of the Team column can be adjusted using team_header. Similarly, the wording of any given custom column number N can be adjusted by col_headerN and this wording is used instead of any wording set by a column style.