This module is rated as beta, and is ready for widespread use. It is still new and should be used with some caution to ensure the results are as expected. |
This style for Lua-based Module:Sports table is meant to build group and league tables for chess round-robin competitions with a crosstable. Unlike the WDL style, in this style wins and total points are calculated from match data that is provided. Therefore, if you want to use this style without a crosstable, you still need to provide all of the information that would appear in a crosstable, so you might want to explore other options, such as the WDL style. This documentation explains how to use this module with the Chess style in an article or template; check the table of contents for specific items.
Usage
editBasic usage
editIn its simplest form only several parameters need to be used to build a table.
What you type | {{#invoke:Sports table|main|style=Chess
|team1=AAA |team2=BBB |team3=CCC |team4=DDD |team5=CAR
|name_AAA=[[Grandmaster (chess)|Grandmaster]]
|name_BBB=Team 2
|name_CCC=Team 3
|name_DDD=Team 4
|name_CAR={{flagathlete|[[Fabiano Caruana]]|USA}}
}}
| ||||||||||||||||||||||||||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
|
The main command is the {{#invoke:Sports table|main|style=Chess}} statement which calls the module with the Chess style and enables you to set everything up. Then 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 as the team codes if you want, but using short codes (as in the example) can make it easier. For each team, you now define the |name_TTT=
parameters (with TTT replaced by the team code) which determine what name is shown in the table; you can use wiki markup and templates in here as well, as shown in the example. The points and wins will default to 0 if no match data is provided. See #Points to see how to provide this data. See #Footer options and #Dating to see how to change the source and update date.
Points
editPoints are calculated using match data.
What you type | {{#invoke:Sports table|main|style=Chess
|team1=AAA |team2=BBB |team3=CCC |team4=DDD |team5=CAR
|name_AAA=[[Grandmaster (chess)|Grandmaster]]
|name_BBB=Team 2
|name_CCC=Team 3
|name_DDD=Team 4
|name_CAR={{flagathlete|[[Fabiano Caruana]]|USA}}
|winpoints=2
|drawpoints=1
|losspoints=-0.1
|disp_fractions=no
|match_AAA_BBB=1+0
|match_AAA_CCC=1+½
|match_AAA_DDD=½+
|match_AAA_CAR= +0
|hth_AAA=1.9
|match_BBB_AAA=1+0
|match_BBB_CCC=½+½
|match_BBB_DDD=½+0
|match_BBB_CAR=½
|hth_BBB=1.9
|match_CCC_AAA=½+0
|match_CCC_BBB=½+½
|match_CCC_DDD=1
|match_CCC_CAR=
|match_DDD_AAA= +½
|match_DDD_BBB=1+½
|match_DDD_CCC= +0
|match_CAR_AAA=1+
|match_CAR_BBB= +½
}}
| ||||||||||||||||||||||||||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
|
The match data that is used to calculate points is given by |match_XXX_YYY=
where XXX and YYY are different team codes. This parameter takes a value of W+B, where W is the result as white and B is the result as black. The results use the character 1 for a win, ½ for a draw, and 0 for a loss. Note that incomplete information such as ½+ is allowed, and still calculates correctly. As a default, a win is worth 1 point, a draw 0.5 points and a loss 0 points, these values can be overwritten to what you need by |winpoints=
, |drawpoints=
and |losspoints=
, if such parameters are provided. Head-to-head values are not calculated automatically, and are given by the parameter |hth_XXX=
. The parameter |disp_fractions=
determines whether the calculated points and head-to-head values (if any are given) are displayed as fractions or decimals. Note that this parameter should only be set to yes if |winpoints=
, |drawpoints=
and |losspoints=
are a multiple of 1⁄2. Otherwise, an incorrect fraction will be displayed.
Crosstable
editBecause the match data already needs to be provided for use with this style, very little additional data is needed to create the crosstables.
What you type | {{#invoke:Sports table|main|style=Chess
|team1=AAA |team2=BBB |team3=CCC |team4=DDD |team5=CAR
|name_AAA=[[Grandmaster (chess)|Grandmaster]]
|name_BBB=Team 2
|name_CCC=Team 3 |short_CCC={{Abbr|3|Team 3}}
|name_DDD=Team 4
|name_CAR={{flagathlete|[[Fabiano Caruana]]|USA}}
|winpoints=2
|drawpoints=1
|losspoints=-0.1
|disp_fractions=no
|show_matches=yes
|match_AAA_BBB=1+0
|match_AAA_CCC=1+½
|match_AAA_DDD=½+
|match_AAA_CAR= +0
|hth_AAA=1.9
|match_BBB_AAA=1+0
|match_BBB_CCC=½+½
|match_BBB_DDD=½+0
|match_BBB_CAR=½
|hth_BBB=1.9
|match_CCC_AAA=½+0
|match_CCC_BBB=½+½
|match_CCC_DDD=1
|match_CCC_CAR=
|match_DDD_AAA= +½
|match_DDD_BBB=1+½
|match_DDD_CCC= +0
|match_CAR_AAA=1+
|match_CAR_BBB= +½
}}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
|
The |show_matches=
parameter determines whether the crosstable is shown, and defaults to no. In the crosstable, the values given by |match_XXX_YYY=
are shown. The headers for the columns are given by |short_XXX=
. If no value for |short_XXX=
is given, then one is created automatically from the team code, with appropriate wikilinks and {{flagathlete}} data included. It is recommended to set the value of |short_XXX=
using the {{Abbr}} template with a short abbreviation (possibly the player's initials) to appear in header of the columns of the crosstable.
Customizing the crosstable
editThere are a few parameters that can be used to customize crosstables.
What you type | {{#invoke:Sports table|main|style=Chess
|team1=AAA |team2=BBB |team3=CCC |team4=DDD |team5=CAR
|name_AAA=[[Grandmaster (chess)|Grandmaster]]
|name_BBB=Team 2
|name_CCC=Team 3 |short_CCC={{Abbr|3|Team 3}}
|name_DDD=Team 4
|name_CAR={{flagathlete|[[Fabiano Caruana]]|USA}}
|show_matches=yes
|crosstable_fractions=yes
|short_style=noflag
|solid_cell=silver
|match_AAA_BBB=1+0+½+½
|match_AAA_CCC=1+½
|match_AAA_DDD=½+
|match_AAA_CAR= +0
|hth_AAA=2
|match_BBB_AAA=1+0+½+½
|match_BBB_CCC=½+½
|match_BBB_DDD=½+0
|match_BBB_CAR=½
|hth_BBB=2
|match_CCC_AAA=0+½
|bgcol_CCC_AAA=B+W
|match_CCC_BBB=½+½
|match_CCC_DDD=1
|match_CCC_CAR=
|match_DDD_AAA= +½
|match_DDD_BBB=1+½
|match_DDD_CCC= +0
|match_CAR_AAA=1+
|bgcol_CAR_AAA=W+W+W+W+W+W+W+W+W
|match_CAR_BBB= +½
}}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
|
What you type | {{#invoke:Sports table|main|style=Chess
|team1=AAA |team2=BBB |team3=CCC |team4=DDD |team5=CAR
|name_AAA=[[Grandmaster (chess)|Grandmaster]]
|name_BBB=Team 2
|name_CCC=Team 3 |short_CCC={{Abbr|3|Team 3}}
|name_DDD=Team 4
|name_CAR={{flagathlete|[[Fabiano Caruana]]|USA}}
|show_matches=yes
|use_pos_short=yes
|short_style=nocountry
|colorbg=no
|solid_cell=silver
|match_AAA_BBB=1+0+½+½
|match_AAA_CCC=1+½
|match_AAA_DDD=½+
|match_AAA_CAR= +0
|hth_AAA=2
|match_BBB_AAA=1+0+½+½
|match_BBB_CCC=½+½
|match_BBB_DDD=½+0
|match_BBB_CAR=½
|hth_BBB=2
|match_CCC_AAA=0+½
|bgcol_CCC_AAA=B+W
|match_CCC_BBB=½+½
|match_CCC_DDD=1
|match_CCC_CAR=
|match_DDD_AAA= +½
|match_DDD_BBB=1+½
|match_DDD_CCC= +0
|match_CAR_AAA=1+
|bgcol_CAR_AAA=W+W+W+W+W+W+W+W+W
|match_CAR_BBB= +½
}}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
|
As shown in this example, no parameter is needed to determine the number of games per match. This is calculated automatically from the largest number of plus signs in the match data.
If the |use_pos_short=
parameter is set to "yes", then the automatically generated short name is generated from the position in the table rather than the team code.
In the previous example, when no |short_XXX=
parameter was given for a team whose |name_XXX=
contained a {{flagathlete}} template, a short column header was created containing the appropriate flag.
However, when |short_style=
is set to "noflag", then no flag is displayed in the automatically created header.
If instead |short_style=
is set to "nocountry", then no country code is displayed in the automatically created header as well as no flag.
Column headers explicitly defined by |short_XXX=
are not affected by |use_pos_short=
or |short_style=
.
If the parameter |crosstable_fractions=
is set to yes, then draws in the crosstable will be displayed as 1⁄2 instead of using the unicode character ½.
While the games in a match typically show the white background first, and the black background second, this behavior can be changed using the |bgcol_XXX_YYY=
parameter.
When no |bgcol_XXX_YYY=
data is present, the background alternates between white and black for each successive game.
If the |colorbg=
parameter is set to no, then no cells in the crosstable will be colored black, even if there is |bgcol_XXX_YYY=
data present.
The |solid_cell=
parameter determines the color of the cells of the crosstable's main diagonal.
Currently, |solid_cell=
may take on the values "gray", "grey", "lightgray", "lightgrey", or "silver", as well as "#xxx" or "#xxxxxx" where the x indicates a valid hexadecimal digit. If no value or an invalid value is given, then the entries on the main diagonal will display an Em dash in a cell with the table background color.
Customizing columns
editSeveral columns can be customized in these tables.
Altering default columns
editYou may choose not to display some of the default columns.
What you type | {{#invoke:Sports table|main|style=Chess
|team1=AAA |team2=BBB |team3=CCC |team4=DDD |team5=CAR
|name_AAA=[[Grandmaster (chess)|Grandmaster]]
|name_BBB=Team 2
|name_CCC=Team 3
|name_DDD=Team 4
|name_CAR={{flagathlete|[[Fabiano Caruana]]|USA}}
|hide_played=yes
|score_over_played=yes
|show_hth=no
|show_win=no
|postitle=Rank
|player_header=Player list
|score_width=90
|match_AAA_BBB=1+0
|match_AAA_CCC=1+½
|match_AAA_DDD=½+
|match_AAA_CAR= +0
|match_BBB_AAA=1+0
|match_BBB_CCC=½+½
|match_BBB_DDD=½+0
|match_BBB_CAR=½
|match_CCC_AAA=½+0
|match_CCC_BBB=½+½
|match_CCC_DDD=1
|match_CCC_CAR=
|match_DDD_AAA= +½
|match_DDD_BBB=1+½
|match_DDD_CCC= +0
|match_CAR_AAA=1+
|match_CAR_BBB= +½
}}
| ||||||||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
|
The column for the number of games played can be hidden with the |hide_played=
parameter.
Whether or not that column is hidden, score can be displayed as score / games played by using the |score_over_played=
parameter. This parameter should be set to yes only when |hide_played=
is set to yes, in order to avoid duplicated information.
To hide the H2H and Wins columns, just set |show_hth=
and |show_win=
, respectively, to no. Similar behavior may be obtained by using the |only_pld_pts=
parameter to only show the games played and score columns to the right of the player name. For more information on |only_pld_pts=
, or on the |postitle=
parameter used in this table, see #Appearance.
The leftmost column, which specifies the position of each player, may be hidden using the |show_positions=
parameter.
The |player_header=
parameter may be used to give the player column a custom header, instead of the default value of Player seen in other examples on this page.
Wins, Draws, and Losses
editFor backwards compatibility with the WDL style, it is possible to choose whether to display the Wins, Draws, and Losses columns.
What you type | {{#invoke:Sports table|main|style=Chess
|team1=AAA |team2=BBB |team3=CCC |team4=DDD |team5=CAR
|name_AAA=[[Grandmaster (chess)|Grandmaster]]
|name_BBB=Team 2
|name_CCC=Team 3
|name_DDD=Team 4
|name_CAR={{flagathlete|[[Fabiano Caruana]]|USA}}
|show_win=yes
|show_draw=yes
|show_loss=yes
|wdl_iff_hth=yes
|hth_before_w=no
|match_AAA_BBB=1+0
|match_AAA_CCC=1+½
|match_AAA_DDD=½+
|match_AAA_CAR= +0
|hth_AAA=1
|match_BBB_AAA=1+0
|match_BBB_CCC=½+½
|match_BBB_DDD=½+0
|match_BBB_CAR=½
|hth_BBB=1
|match_CCC_AAA=½+0
|match_CCC_BBB=½+½
|match_CCC_DDD=1
|match_CCC_CAR=
|match_DDD_AAA= +½
|match_DDD_BBB=1+½
|match_DDD_CCC= +0
|match_CAR_AAA=1+
|match_CAR_BBB= +½
}}
| ||||||||||||||||||||||||||||||||||||||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
|
We saw the |show_win=
parameter in the previous example, but there are also |show_draw=
and |show_loss=
parameters, which similarly determine whether the Draws and Losses columns, respectively, will be shown. The default value of |show_win=
is yes, while the default values of |show_draw=
and |show_loss=
are no.
As seen in previous tables, the H2H column usually appears before the Wins column. If you wish the H2H column to show up immediately after whichever of the Wins, Draws, and Losses columns are present, you may set the |hth_before_w=
parameter to no.
If the parameter |wdl_iff_hth=
is set to yes, then any wins, draws, or losses will only be displayed if head to head data has been defined for a given player.
Sonneborn–Berger score
editIn addition to other automatic calculations done by this module, there is also the possibility to calculate the Sonneborn–Berger score.
What you type | {{#invoke:Sports table|main|style=Chess
|team1=AAA |team2=BBB |team3=CCC |team4=DDD |team5=CAR
|name_AAA=[[Grandmaster (chess)|Grandmaster]]
|name_BBB=Team 2
|name_CCC=Team 3
|name_DDD=Team 4
|name_CAR={{flagathlete|[[Fabiano Caruana]]|USA}}
|winpoints=2
|drawpoints=1
|losspoints=-0.1
|show_sb=yes
|sb_iff_hth=yes
|disp_fractions=no
|match_AAA_BBB=1+0
|match_AAA_CCC=1+½
|match_AAA_DDD=½+
|match_AAA_CAR= +0
|hth_AAA=1.9
|match_BBB_AAA=1+0
|match_BBB_CCC=½+½
|match_BBB_DDD=½+0
|match_BBB_CAR=½
|hth_BBB=1.9
|nosb_BBB=yes
|match_CCC_AAA=½+0
|match_CCC_BBB=½+½
|match_CCC_DDD=1
|match_CCC_CAR=
|match_DDD_AAA= +½
|match_DDD_BBB=1+½
|match_DDD_CCC= +0
|match_CAR_AAA=1+
|match_CAR_BBB= +½
}}
| ||||||||||||||||||||||||||||||||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
|
The |show_sb=
parameter shows a column containing the Sonneborn–Berger score of each player calculated from their match results.
The Sonneborn–Berger score is calculated by taking the number of points gained against a given opponent multiplied by the total number of points that opponent scored, and then summing this product over all of the players.
If the parameter |sb_before_w=
is set to yes, then the column containing the Sonneborn–Berger score of each player appears immediately before the win column. If |hth_before_w=
is also set to yes, the column containing the Sonneborn–Berger score of each player comes after the HTH column.
If the parameter |sb_before_w=
is set to the default value of no, then this column comes after both the H2H column as well as whichever of the Wins, Draws, and Losses columns are present.
The values in this column are always given as decimals regardless of |disp_fractions=
.
If the parameter |sb_iff_hth=
is set to yes, then a calculated Sonneborn–Berger score will only be displayed if head to head data has been defined for a given player.
Additionally, you may set the |nosb_XXX=
parameter to yes for any given player with team code XXX in order to prevent that particular player's Sonneborn–Berger score from being displayed.
Other additional columns
editThe data for this table comes from the 3rd Sinquefield Cup, which was a single round-robin event held in 2015.
What you type | {{#invoke:Sports table|main|style=Chess
|source={{cite web|title=Sinquefield Cup 2015
|url=https://www.chessgames.com/perl/chess.pl?tid=86250&crosstable=1&kpage=44|accessdate=9 April 2020}}
|class_rules={{cite web|title=Tie Break Regulations Grand Chess Tour
|url=https://grandchesstour.org/tie-break-regulations|accessdate=9 April 2020}}
|title=3rd Sinquefield Cup, 22 August – 3 September 2015, [[St. Louis]], [[Missouri]], [[United States]]
|postitle=Rank
|hide_played=yes
|show_rating=yes
|rate_date=Aug. 2015{{refn|group=lower-alpha|https://grandchesstour.org/2015-sinquefield-cup/overview}}
|hth_before_w=no
|show_sb=yes
|extra_cols=2
|extra_header1={{Abbr|[[Glossary of chess#performance rating|TPR]]|Tournament performance rating}}
|extra_header2=[[Grand Chess Tour|Tour Points]]
|show_matches=true
|solid_cell=silver
|update=complete
|result1=WIN
|col_WIN=green1
|team1=ARO |team2=MC |team3=NAK |team4=MVL |team5=GIR |team6=GRI |team7=TOP |team8=FC |team9=ANA |team10=WSO
|name_ARO={{flagathlete|[[Levon Aronian]]|ARM}} |short_ARO={{Abbr|LA|Levon Aronian}}
|name_MC={{flagathlete|[[Magnus Carlsen]]|Norway}} |short_MC={{Abbr|MC|Magnus Carlsen}}
|name_NAK={{flagathlete|[[Hikaru Nakamura]]|USA}} |short_NAK={{Abbr|HN|Hikaru Nakamura}}
|name_MVL={{flagathlete|[[Maxime Vachier-Lagrave]]|FRA}} |short_MVL={{Abbr|MVL|Maxime Vachier-Lagrave}}
|name_GIR={{flagathlete|[[Anish Giri]]|NED}} |short_GIR={{Abbr|Giri|Anish Giri}}
|name_GRI={{flagathlete|[[Alexander Grischuk]]|RUS}} |short_GRI={{Abbr|AG|Alexander Grischuk}}
|name_TOP={{flagathlete|[[Veselin Topalov]]|BUL}} |short_TOP={{Abbr|VT|Veselin Topalov}}
|name_FC={{flagathlete|[[Fabiano Caruana]]|USA}} |short_FC={{Abbr|FC|Fabiano Caruana}}
|name_ANA={{flagathlete|[[Viswanathan Anand]]|IND}} |short_ANA={{Abbr|VA|Viswanathan Anand}}
|name_WSO={{flagathlete|[[Wesley So]]|USA}} |short_WSO={{Abbr|WS|Wesley So}}
|rating_ARO=2765 |extra1_ARO=2923 |extra2_ARO=13
|rating_MC=2853 |extra1_MC=2831 |extra2_MC=10
|rating_NAK=2814 |extra1_NAK=2835 |extra2_NAK=8
|rating_MVL=2731 |extra1_MVL=2845 |extra2_MVL=7
|rating_GIR=2793 |extra1_GIR=2838 |extra2_GIR=6
|rating_GRI=2771 |extra1_GRI=2797 |extra2_GRI=5
|rating_TOP=2816 |extra1_TOP=2792 |extra2_TOP=4
|rating_FC=2808 |extra1_FC=2713 |extra2_FC=3
|rating_ANA=2816 |extra1_ANA=2712 |extra2_ANA=2
|rating_WSO=2779 |extra1_WSO=2671 |extra2_WSO=1
|matchrow_ARO= —,½,1,½,½,½,½,1,½,1
|matchrow_MC= ½,—,½,1,½,0,0,1,½,1 |hth_MC=½
|matchrow_NAK= 0,½,—,½,½,1,0,½,1,1 |hth_NAK=½
|matchrow_MVL= ½,0,½,—,½,½,1,½,½,1
|matchrow_GIR= ½,½,½,½,—,1,½,½,½,½
|matchrow_GRI= ½,1,0,½,0,—,½,1,1,0
|matchrow_TOP= ½,1,1,0,½,½,—,0,½,½
|matchrow_FC= 0,0,½,½,½,0,1,—,½,½
|matchrow_ANA= ½,½,0,½,½,0,½,½,—,½
|matchrow_WSO= 0,0,0,0,½,1,½,½,½,—
}}
{{reflist|group=lower-alpha}}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
What it looks like |
Source: "Sinquefield Cup 2015". Retrieved 9 April 2020.
Rules for classification: "Tie Break Regulations Grand Chess Tour". Retrieved 9 April 2020. |
If the |show_rating=
parameter is set to yes, then a column is shown immediately after the player names with values defined by |rating_XXX=
for each team code XXX.
Similarly, if the |extra_cols=
parameter is set to some number N, then N columns are shown just before the crosstable, if one is present, with values defined by |extraN_XXX=
for each column N and each team code XXX.
The header of any extra column may be set using |extra_headerN=
for each N.
The header of the rating column also includes some information that may be chosen by a parameter. The contents of the |rate_date=
parameter will be displayed in small text below the word "Rating" in the header.
Note that it is possible to include the {{refn}} template inside any of these custom headers. Because all other notes in this module use the "lower-alpha" group, it is recommended that any use of {{refn}} in a parameter in this module also use the "lower-alpha" group. If any notes are generated by the module, then a {{reflist|group=lower-alpha}} template will also be generated at the end of the module. However, if no notes are generated by the module, then you will have to call this yourself as shown at the end of the example. There is no detriment to calling this twice, so it is a good idea to include this template yourself whenever you call {{refn}} in a parameter.
For more information on notes in this module, see #Notes.
For information on using |matchrow_XXX=
instead of |match_XXX_YYY=
see #Matchrow.
For information on |source=
, |class_rules=
, and |update=
used in this table, see #Footer options.
Special case for only two players
editWhen there are only two players, the module enters a special case. The data for the following table comes from the 2014 World Chess Championship.
What you type | {{#invoke:Sports table|main|style=Chess
|source={{cite web|title=Anand vs Carlsen, 2014
|url=https://www.chessgames.com/perl/chess.pl?tid=84885|accessdate=9 April 2020}}
|update=complete
|title=World Chess Championship 2014
|show_positions=no
|hide_played=yes
|only_pld_pts=yes
|show_matches=yes
|team1=MC |team2=VA
|name_MC={{flagathlete|[[Magnus Carlsen]]|Norway}}
|name_VA={{flagathlete|[[Viswanathan Anand]]|India}}
|match_MC_VA=½+1+0+½+½+1+½+½+½+½+1+—
|bgcol_MC_VA=B+W+B+W+B+W+W+B+W+B+W+B
|match_VA_MC=½+0+1+½+½+0+½+½+½+½+0+—
|bgcol_VA_MC=W+B+W+B+W+B+B+W+B+W+B+W
|game1_header=<small>[http://www.chessbomb.com/arena/2014-wcc/01-Anand_Viswanathan-Carlsen_Magnus Game 1]<br />8 Nov.</small>
|game2_header=<small>[http://www.chessbomb.com/arena/2014-wcc/02-Carlsen_Magnus-Anand_Viswanathan Game 2]<br />9 Nov.</small>
|game3_header=<small>[http://www.chessbomb.com/arena/2014-wcc/03-Anand_Viswanathan-Carlsen_Magnus Game 3]<br />11 Nov.</small>
|game4_header=<small>[http://www.chessbomb.com/arena/2014-wcc/04-Carlsen_Magnus-Anand_Viswanathan Game 4]<br />12 Nov.</small>
|game5_header=<small>[http://www.chessbomb.com/arena/2014-wcc/05-Anand_Viswanathan-Carlsen_Magnus Game 5]<br />14 Nov.</small>
|game6_header=<small>[http://www.chessbomb.com/arena/2014-wcc/06-Carlsen_Magnus-Anand_Viswanathan Game 6]<br />15 Nov.</small>
|game7_header=<small>[http://www.chessbomb.com/arena/2014-wcc/07-Carlsen_Magnus-Anand_Viswanathan Game 7]<br />17 Nov.</small>
|game8_header=<small>[http://www.chessbomb.com/arena/2014-wcc/08-Anand_Viswanathan-Carlsen_Magnus Game 8]<br />18 Nov.</small>
|game9_header=<small>[http://www.chessbomb.com/arena/2014-wcc/09-Carlsen_Magnus-Anand_Viswanathan Game 9]<br />20 Nov.</small>
|game10_header=<small>[http://www.chessbomb.com/arena/2014-wcc/10-Anand_Viswanathan-Carlsen_Magnus Game 10]<br />21 Nov.</small>
|game11_header=<small>[http://www.chessbomb.com/arena/2014-wcc/11-Carlsen_Magnus-Anand_Viswanathan Game 11]<br />23 Nov.</small>
|game12_header=<small>Game 12<br />25 Nov.</small>
}}
| |||||||||||||||||||||||||||||||||||||||||||||
What it looks like |
Source: "Anand vs Carlsen, 2014". Retrieved 9 April 2020.
|
As can be seen from this example, the crosstable now displays a column header for each game in the match, instead of the normally displayed column header for each player. As such, there is no longer a main diagonal of NULL matches. Also, if |short_XXX=
were defined, its value would never be used.
Instead, headers in the match table are determined by the |gameN_header=
parameter for each number N corresponding to a game. The default value for this parameter is the number specified by N.
It is highly recommended to use |bgcol_XXX_YYY=
in two player tables, so that each column can represent a distinct game, in the order that they are played.
It is also recommended that the H2H, Wins, and played columns be hidden in a two player table, because this information is easily discerned from the points.
For information on the |source=
and |update=
parameters used in this table, see #Footer options.
Matchrow
editThere are occasions in which it may be preferable to enter all match data corresponding to one row using one parameter.
What you type | {{#invoke:Sports table|main|style=Chess
|team1=AAA |team2=BBB |team3=CCC |team4=DDD |team5=CAR
|name_AAA=[[Grandmaster (chess)|Grandmaster]]
|name_BBB=Team 2
|name_CCC=Team 3 |short_CCC={{Abbr|3|Team 3}}
|name_DDD=Team 4
|name_CAR={{flagathlete|[[Fabiano Caruana]]|USA}}
|winpoints=2
|drawpoints=1
|losspoints=-0.1
|disp_fractions=no
|show_matches=yes
|matchrow_AAA= ---,1+0,1+½,½+ , +0 |hth_AAA=1.9
|matchrow_BBB= 1+0,---,½+½,½+0,½ |hth_BBB=1.9
|matchrow_CCC= ½+0,½+½,---,1
|matchrow_DDD= +½,1+½, +0
|matchrow_CAR= 1+ , +½
|bgcolrow_CCC= B+W,B+W,---,W+B,B+B
|bgcolrow_CAR= W+W,
}}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
|
Using the |matchrow_XXX=
parameter, only one parameter is needed for the match data per row, rather than a number of parameters equal to the number of players per row. Note that |matchrow_XXX=
data is comma separated, with each value between commas equal to the previously discussed |match_XXX_YYY=
data, with the addition of data for the main diagonal. This value for the main diagonal is a dummy value which is never used and only exists to line matches up so that parameter inputs are easier to read. The dummy value is needed even for the two player special case, when no main diagonal is displayed in the crosstable. For this reason, it is advised that |matchrow_XXX=
not be used in competitions with only 2 players. Additionally, if you use |matchrow_XXX=
, then all match data needs to be changed each time you change the rank of any player. With |match_XXX_YYY=
, no data needs to be changed when re-ordering players. For this reason, it is advised that |matchrow_XXX=
only be used in already completed tournaments, where there is no possibility of changing the order of players.
The parameter |bgcolrow_XXX=
works similarly to |matchrow_XXX=
in that the data is comma separated, except that each value between commas equal to the previously discussed |bgcol_XXX_YYY=
data.
Tiebreak matches
editIn many tournaments, if there is a tiebreak between the top players, additional tiebreak games are played. This module is able to handle these tiebreak games. The data for the following table comes from the 2018 World Chess Championship.
What you type | {{#invoke:Sports table|main|style=Chess
|source={{cite web|title=World Chess Championship 2018: Carlsen vs Caruana
|url=https://www.chess.com/article/view/world-chess-championship-2018-carlsen-caruana|accessdate=9 April 2020}}
|class_rules={{cite web|title=RULES & REGULATIONS FOR THE FIDE WORLD CHAMPIONSHIP MATCH
|url=https://www.fide.com/FIDE/handbook/regulations_match_2018.pdf|accessdate=9 April 2020}}
|update=complete
|title=World Chess Championship 2018
|show_positions=no
|show_hth=no
|show_win=no
|hide_played=yes
|show_matches=yes
|team1=MC |team2=FC
|name_MC={{flagathlete|[[Magnus Carlsen]]|Norway}}
|name_FC={{flagathlete|[[Fabiano Caruana]]|USA}}
|match_MC_FC=½+½+½+½+½+½+½+½+½+½+½+½
|bgcol_MC_FC=B+W+B+W+B+W+W+B+W+B+W+B
|match_FC_MC=½+½+½+½+½+½+½+½+½+½+½+½
|bgcol_FC_MC=W+B+W+B+W+B+B+W+B+W+B+W
|tb_numplayers=2
|extra_cols=1
|extra_header1=[[rapid chess|Rapid]]
|tbmatch_MC_FC=1+1+1 |extra1_MC=3
|tbmatch_FC_MC=0+0+0 |extra1_FC=0
|tbbgcol_FC_MC=B+W+B
}}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
What it looks like |
Source: "World Chess Championship 2018: Carlsen vs Caruana". Retrieved 9 April 2020.
Rules for classification: "RULES & REGULATIONS FOR THE FIDE WORLD CHAMPIONSHIP MATCH" (PDF). Retrieved 9 April 2020. |
The data for the following table comes from the Tata Steel Chess India Blitz tournament in 2018.
What you type | {{#invoke:Sports table|main|style=Chess
|source={{cite web|title=Tata Steel India Chess 2018_Blitz
|url=http://chess-results.com/tnr391775.aspx?lan=1&art=2&flag=30|accessdate=9 April 2020}}
|class_rules={{cite web|title=Tata Steel India Chess 2018_Blitz
|url=http://chess-results.com/tnr391775.aspx?lan=1&art=4&flag=30|accessdate=9 April 2020}}
|postitle=Rank
|hide_played=yes
|show_win=no
|show_sb=yes
|sb_iff_hth=yes
|extra_cols=1
|extra_header1=Playoff
|short_style=nocountry
|show_matches=true
|solid_cell=silver
|disp_fractions=no
|update=complete
|result1=WIN
|col_WIN=green1
|team1=VA |team2=HN |team3=LA |team4=WS |team5=SM |team6=PH |team7=VSG |team8=SK |team9=SSG |team10=PR
|name_VA={{flagathlete|[[Viswanathan Anand]]|IND}}
|name_HN={{flagathlete|[[Hikaru Nakamura]]|USA}}
|name_LA={{flagathlete|[[Levon Aronian]]|ARM}}
|name_WS={{flagathlete|[[Wesley So]]|USA}}
|name_SM={{flagathlete|[[Shakhriyar Mamedyarov]]|AZE}}
|name_PH={{flagathlete|[[Pentala Harikrishna]]|IND}}
|name_VSG={{flagathlete|[[Vidit Santosh Gujrathi]]|IND}}
|name_SK={{flagathlete|[[Sergey Karjakin]]|RUS}}
|name_SSG={{flagathlete|[[Surya Shekhar Ganguly]]|IND}}
|name_PR={{flagathlete|[[Praggnanandhaa Rameshbabu]]|IND}}
|matchrow_VA= ———,½+½,0+½,1+½,½+1,1+½,1+1,½+0,1+1,1+1 |extra1_VA=1.5
|matchrow_HN= ½+½,———,½+½,1+½,1+1,1+0,½+1,½+1,1+1,½+½ |extra1_HN=0.5
|matchrow_LA= ½+1,½+½,———,½+½,1+½,1+0,½+1,1+½,½+½,1+1
|matchrow_WS= ½+0,½+0,½+½,———,1+1,1+0,½+½,½+1,1+0,½+1
|matchrow_SM= 0+½,0+0,½+0,0+0,———,½+½,1+1,½+½,0+1,1+1 |hth_SM=3 |nosb_SM=yes
|matchrow_PH= ½+0,1+0,1+0,1+0,½+½,———,0+½,0+½,1+0,1+½ |hth_PH=1.5
|matchrow_VSG= 0+0,0+½,0+½,½+½,0+0,½+1,———,½+1,½+1,½+1 |hth_VSG=1.5
|matchrow_SK= 1+½,0+½,½+0,0+½,½+½,½+1,0+½,———,½+0,0+1
|matchrow_SSG= 0+0,0+0,½+½,1+0,0+1,1+0,0+½,1+½,———,0+0
|matchrow_PR= 0+0,½+½,0+0,0+½,0+0,½+0,0+½,0+1,1+1,———
|tb_numplayers=2
|tbmatch_VA_HN=1+½
|tbmatch_HN_VA=0+½
|tbbgcol_HN_VA=B+W
}}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
What it looks like |
Source: "Tata Steel India Chess 2018_Blitz". Retrieved 9 April 2020.
Rules for classification: "Tata Steel India Chess 2018_Blitz". Retrieved 9 April 2020. |
If |tb_numplayers=
is a number greater than 1, then a second crosstable will be displayed which may be used for tiebreak match data.
The |tb_numplayers=
parameter determines how many players are involved in the tiebreak matches. Note that tiebreak matches only apply to the players at the top of the table.
For tiebreak match data, the parameters |tbmatch_XXX_YYY=
, |tbbgcol_XXX_YYY=
, |tbmatchrow_XXX=
, and |tbbgcolrow_XXX=
are used in place of |match_XXX_YYY=
, |bgcol_XXX_YYY=
, |matchrow_XXX=
, and |bgcolrow_XXX=
, respectively.
The second crosstable is then displayed following the same rules as the first crosstable.
Note that no information on wins or points is automatically calculated from tiebreak match data.
For information on the |source=
, |class_rules=
, and |update=
parameters used in these tables, see #Footer options.
Generic Customization
editThere are many customization options that are available regardless of which style is used in Module:Sports table. These are presented below.
Footer options
editWhat you type | {{#invoke:Sports table|main|style=Chess |update=1 January 1900 |source=[https://en.wiki.x.io/wiki/Main_Page Wikipedia] |team1=AAA |team2=BBB |team3=CCC |team4=DDD |team5=EEE |name_AAA=Team A |name_BBB=Team B |name_CCC=Team C |name_DDD=Team D |name_EEE=Team E |class_rules=1) points; 2) goal difference; 3) number of goals scored. }} | ||||||||||||||||||||||||||||||||||||
What it looks like |
Updated to match(es) played on 1 January 1900. Source: Wikipedia
Rules for classification: 1) points; 2) goal difference; 3) number of goals scored. |
The footer information can be customized (although notes and status will be inserted automatically if they are called; see XXX and YYY). The update date is set by |update=
, see below for details. If no source is given a citation-needed tag is shown, |source=
can provide an actual link. The classification results can be shown with |class_rules=
, either directly or as a wikilink to a tie-breaker rules section. Using |only_pld_pts=no_hide_class_rules
suppresses the classification rules (this should only be used in template calls when multiple groups are summarized on a page and the rules are listed elsewhere on that page).
Dating
editThe default description is match(es), this can be changed by calling |matches_text=
for any other term.
- Active season
What you type | {{#invoke:Sports table|main|style=Chess |update=1 January 1900 }} | ||||||
What it looks like |
Updated to match(es) played on 1 January 1900. Source: [citation needed]
|
When the season is active, the footer should include the date of the last match played that is included in the table. This can be achieved by setting |update=date
.
- Completed season
What you type | {{#invoke:Sports table|main|style=Chess |update=complete }} | ||||||
What it looks like |
Source: [citation needed]
|
When all matches have been played, the season is completed and the update line can be removed by setting |update=complete
.
- Future season
What you type | {{#invoke:Sports table|main|style=Chess |update=future |start_date=1 January 2121 }} | ||||||
What it looks like |
First match(es) will be played: 1 January 2121. Source: [citation needed]
|
Before any games are played, the date of the first game should be indicated by using |update=future
and setting the start date by |start_date=
.
Stacking
editUsing |only_pld_pts=
makes the table smaller, which may lead to undesired width and linebreaks in the footer that can be fixed with parameter |stack_footer=
. By setting |stack_footer=yes
(or y, t, true or 1 or upper case variant of those) every new information, such as "source" and statuses, is displayed on a new row.
- Without stack_footer
What you type | {{#invoke:Sports table|main|style=Chess |only_pld_pts=yes |team1=AAA |name_AAA=The A Team |result1=RRR |status_AAA=DEOPRT |res_col_header=PQR |col_RRR= |text_RRR=Plain text }} | ||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
(D) Disqualified; (E) Eliminated; (O) Play-off winner; (P) Promoted; (R) Relegated; (T) Qualified, but not yet to the particular phase indicated |
- With stack_footer
What you type | {{#invoke:Sports table|main|style=Chess |only_pld_pts=yes |stack_footer=yes |team1=AAA |name_AAA=The A Team |result1=RRR |status_AAA=DEOPRT |res_col_header=PQR |col_RRR= |text_RRR=Plain text }} | ||||||||
What it looks like |
Updated to match(es) played on unknown.
Source: [citation needed] (D) Disqualified; (E) Eliminated; (O) Play-off winner; (P) Promoted; (R) Relegated; (T) Qualified, but not yet to the particular phase indicated |
Appearance
editWhat you type | {{#invoke:Sports table|main|style=Chess |team1=AAA |team2=BBB |team3=CCC |team4=DDD |team5=EEE |name_AAA=Team A |name_BBB=Team B |name_CCC=Team C |name_DDD=Team D |name_EEE=Team E |only_pld_pts=yes }} | ||||||||||||||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
|
What you type | {{#invoke:Sports table|main|style=Chess |team1=AAA |team2=BBB |team3=CCC |team4=DDD |team5=EEE |name_AAA=Team A |name_BBB=Team B |name_CCC=Team C |name_DDD=Team D |name_EEE=Team E |split2=yes |split3= |split5=1 |teamwidth=250 |postitle={{abbr|Exam.|Example}} }} | ||||||||||||||||||||||||||||||||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
|
What you type | {{#invoke:Sports table|main|style=Chess |team1=AAA |team2=BBB |team3=CCC |team4=DDD |team5=EEE |name_AAA=Team A |name_BBB=Team B |name_CCC=Team C |name_DDD=Team D |name_EEE=Team E |show_groups=yes |group_AAA=A |group_BBB=A |group_CCC=B |group_DDD=B |group_EEE=C }} | ||||||||||||||||||||||||||||||||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
|
Only the position, team, matches and points columns can be displayed by defining |only_pld_pts=yes
(or y, t, true or 1 or upper case variant of those); |only_pld_pts=no_hide_class_rules
suppresses the classification rules only (this should only be used in template calls when multiple groups are summarized on a page and the rules are listed elsewhere on that page).
A line can be added between section of the table (if desired) by adding |splitN=
with N the position below which the bar should be shown. (Note that this bar will not be shown for the bottom position in the table).
A custom width of the team column can be set by |teamwidth=
, for example when multiple groups exist within one tournament and you want to force the same width on all groups.
The position column header can be customized by |postitle=
and the position labels by |pos_TTT=
for each team.
When multiple a table compares teams from multiple groups, the group can also be listed by setting |show_groups=yes
(or y, t, true or 1 or upper case variant of those) and using |group_TTT=
to indicate what teams comes from what group. The group column header can be customized by |group_header=
, for example |group_header=<abbr title="League">Lge</abbr>
.
Team highlighting and partial table
editWhat you type | {{#invoke:Sports table|main|style=Chess |showteam=DDD |team1=AAA |team2=BBB |team3=CCC |team4=DDD |team5=EEE |name_AAA=Team A |name_BBB=Team B |name_CCC=Team C |name_DDD=Team D |name_EEE=Team E |show_limit=3 }} | ||||||||||||||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
|
When using a table on a team (season) page, you might want to highlight the team (and possibly only show part of the table), especially after a template call to a long league table. Team TTT is highlighted by |showteam=TTT
. A limited part of the table is shown by |show_limit=
, with the number indicating the number of position to show (if this is an even number, and it is in the middle of the table, then this number will be rounded up to the next odd number to show symmetry above and below).
A table can also start at position N, by using |highest_pos=N
in the module call.
Results and status
editIndicating results
editWhat you type | {{#invoke:Sports table|main|style=Chess |team1=AAA |team2=BBB |team3=CCC |team4=DDD |team5=EEE |result1=WC |result2=PO |result3=PO |result4=RPO |result5=rel |name_AAA=Team A |name_BBB=Team B |name_CCC=Team C |name_DDD=Team D |name_EEE=Team E |res_col_header=QR |col_WC=green1 |text_WC=Qualification for [[World Cup]] |col_PO=blue1 |text_PO=Qualification for play-offs |col_RPO=red2 |text_RPO=Qualification for relegation play-offs |col_rel=red1 |text_rel=Relegation to lower division }} | |||||||||||||||||||||||||||||||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
|
The result of the table rankings can be indicated by a colored bar and text indicating the result. The header of this column is defined by |res_col_header=
with predefined values of Q, QR, P, PQR, PR and R (indicating various combinations of promotion, qualification and relegation), any other entry than these exact codes will print as that entry in the column header. With N the position |resultN=
declares the codes (or words if you want that instead) for the results column. Now when RRR is the results column, the colors are defined by |col_RRR=
. The colors green1, green2, green3, green4, blue1, blue2, blue3, blue4, yellow1, yellow2, yellow3, yellow4, red1, red2, red3, red4, black1, black2, black3 and black4 are predefined and should be used preferentially per consensus on WT:FOOTY (you can use either html colors, or RGB color codes instead if you must [this is not recommended though, because it might violate WP:COLOR]). The text in the results column is now give by |text_RRR=
, which can (and should) link to the relevant competition articles.
Consensus is also to use the colors in the following way: Green should be used for the top-level positive event (promotion, qualification, advancing to next round), blue for the second-level positive events (promotion play-offs when direct promotion exists, play-offs when direct qualification exist, secondary continental tornament), red for bottom-level negative events (relegation) and yellow for other level events. In addition, lower level colors should be used when teams qualify for different rounds (with lower levels corresponding to entry in lower rounds [green1 first, then green2, etc].) Black should be used when teams do not play a full season and their results are expunged or void. This consensus exists to have a uniform table appearance across Wikipedia. In addition, some wikiprojects have more detailed guidelines:
Green | green1 | green2 | green3 | green4 |
---|---|---|---|---|
Blue | blue1 | blue2 | blue3 | blue4 |
Yellow | yellow1 | yellow2 | yellow3 | yellow4 |
Red | red1 | red2 | red3 | red4 |
Black | black1 | black2 | black3 | black4 |
Orange | orange1 | orange2 | White | white1 |
Indicating status
editWhat you type | {{#invoke:Sports table|main|style=Chess |status_pos=after |team1=AAA |result1=RRR |status_AAA=ABCDEFGHIJKLMNOPQRSTUVWXYZ |name_AAA=Team A |res_col_header=PQR |col_RRR= |text_RRR=Plain text |status_text_X=Custom 1 |status_text_Y=Custom 2 |status_text_Z=Custom 3 }} | ||||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
(A) Advance to a further round; (C) Champion; (D) Disqualified; (E) Eliminated; (G) Guest; (H) Host; (O) Play-off winner; (P) Promoted; (Q) Qualified to the phase indicated; (R) Relegated; (T) Qualified, but not yet to the particular phase indicated; (X) Custom 1; (Y) Custom 2; (Z) Custom 3 |
What you type | {{#invoke:Sports table|main|style=Chess |status_pos=before |team1=AAA |status_AAA=ABCDEFGHIJKLMNOPQRSTUVWXYZ |name_AAA=Team A |status_text_X=Custom 1 |status_text_Y=Custom 2 |status_text_Z=Custom 3 }} | ||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
a – Advance to a further round; c – Champion; d – Disqualified; e – Eliminated; g – Guest; h – Host; o – Play-off winner; p – Promoted; q – Qualified to the phase indicated; r – Relegated; t – Qualified, but not yet to the particular phase indicated; x – Custom 1; y – Custom 2; z – Custom 3 |
The promotion/qualification/relegation status of a team can be indicated by |status_TTT=
with the letters indicated above (although only the ones in use for this style are shown below the table). The letters will appear next to the team in the order given. Whichever letters are called out in the table will automatically be explained alphabetically in the footer.
These letters can be used for all scenarios as exemplified by the following group phase example with 4 teams that play 3 matches where the first advances directly, the second team will go to play-offs and the remaining two teams are eliminated:
- Teams start out without status letter
- Teams that get eliminated get status (E)
- Teams that can still finish worse than second (and might be eliminated) will remain without status
- Teams that will finish at least second will get status (T)
- Teams that will finish for sure second will get status (Q)
- Teams that will finish for sure first will get status (A)
If these scenarios are not sufficient, some style have wild letters L (marked with a question mark in the overview). They should be accompanied by |status_text_L=
to indicate a non-standard status.
Most styles allow for these letter to be placed after the team name or before, set |status_pos=after
or |status_pos=before
respectively, the default value can differ and its use differs between sports or regions.
Notes
editWhat you type | {{#invoke:Sports table|main|style=Chess |team1=AAA |team2=BBB |team3=CCC |team4=DDD |team5=EEE |result1=WC |result2=PO |result3=PO |result4=RPO |result5=rel |note_AAA=Team note |note_BBB=AAA |hth_BBB=Team 2 wins head-to-head against team 3 |hth_CCC=BBB |note_DDD=EEE |name_AAA=Team A |name_BBB=Team B |name_CCC=Team C |name_DDD=Team D |name_EEE=Team E |res_col_header=QR |note_header_res=Header note |col_WC=green1 |text_WC=Qualification for [[World Cup]] |note_res_WC=Result note |col_PO=blue1 |text_PO=Qualification for play-offs |col_RPO=red2 |text_RPO=Qualification for relegation play-offs |note_res_RPO=WC |col_rel=red1 |text_rel=Relegation to lower division }} | |||||||||||||||||||||||||||||||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed]
Notes: |
When notes are present, they are automatically added to the footer. The following notes are available for teams with |note_TTT=
for a note for a team, when this note is a team code with a defined notes, they will share the note. Results can have notes with |note_res_RRR=
and the result header can have a note with |note_header_res=
. Head-to-head result tiebreakers are listed in the points column and can be inserted with |hth_TTT=
, which can be shared between teams as with all-purpose notes.
Matches
editWhat you type | {{#invoke:Sports table|main|style=Chess |show_matches=true |team1=AAA |team2=BBB |team3=CCC |team4=DDD |team5=EEE |name_AAA=Team A |short_AAA=AAA |name_BBB=Team B |short_BBB=BBB |name_CCC=Team C |short_CCC=CCC |name_DDD=Team D |short_DDD=DDD |name_EEE=Team E |short_EEE=EEE |match_AAA_BBB=1–0 |match_AAA_CCC=0–1 |match_AAA_DDD=<small>16 Nov '14</small> |match_AAA_EEE=<small>3 Sep '15</small> |match_BBB_AAA= |match_BBB_CCC=<small>3 Sep '15</small> |match_BBB_DDD=B–D |match_BBB_EEE=<small>3 Sep '15</small> |match_CCC_AAA=<small>16 Nov '14</small> |match_CCC_BBB=C–B |match_CCC_DDD=<small>16 Nov '14</small> |match_CCC_EEE=C–E |match_DDD_AAA=D–A |match_DDD_BBB=<small>3 Sep '15</small> |match_DDD_CCC=D–C |match_DDD_EEE=<small>3 Sep '15</small> |match_EEE_AAA= |match_EEE_BBB=9–5 |match_EEE_CCC=<small>16 Nov '14</small> |match_EEE_DDD=E–D |match_EEE_DDD_note=Pitch was taken by [[Martian|Martians]], the match will be played in [[Iani Chaos]] instead. }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
What it looks like |
Updated to match(es) played on unknown. Source: [citation needed] Notes:
|
The match list can be added by displayed by defining |show_matches=yes
(or y, t, true or 1 or upper case variant of those). The column headers for the match results are defined by |short_TTT=
for team TTT. The results for the game TTT vs. SSS can now be input by |match_TTT_SSS=
. Future games can be listed with their date (possibly between small tags) or they can be left blank. (Note that this calls Module:Sports results to build the match table.) A note can be added to a result using |match_TTT_SSS_note=
, this note can be shared with team TTT note by setting |match_TTT_SSS_note=TTT
when |note_TTT=
is set. The width of the match columns can be customized by setting |match_col_width=
to the desired width.
Note that match notes do not show up properly at this time when the number of games per match is not 1.
-- Style for chess tables
local pp = {}
function pp.preprocess(Args,N_teams,prefix,drawfractions)
local legs = 1
for ii=1,N_teams do
local ti = Args['team' .. ii]
Args[prefix..'win_'..ti] = 0
Args[prefix..'draw_'..ti] = 0
Args[prefix..'loss_'..ti] = 0
local matchrow_str = Args[prefix..'matchrow_' .. ti] or ''
for jj=1,N_teams do
local tj = Args['team' .. jj]
if ii ~= jj then
if matchrow_str ~= '' then
Args[prefix..'match_' .. ti .. '_' .. tj] = mw.ustring.match(matchrow_str, '^([^,]*),?')
end
local match_str = Args[prefix..'match_' .. ti .. '_' .. tj] or ''
local game_count = 1
while match_str ~= '' do
local gii = mw.ustring.match(match_str, '^([^%+]*)%+?')
gii = mw.ustring.gsub(gii or '','^%s*','') -- Trim starting whitespace
gii = mw.ustring.gsub(gii or '','%s*$','') -- Trim ending whitespace
if gii == '1' then
Args[prefix..'win_'..ti] = Args[prefix..'win_'..ti] + 1
elseif gii == '½' then
Args[prefix..'draw_'..ti] = Args[prefix..'draw_'..ti] + 1
if drawfractions then
gii = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Screen reader-only/styles.css' }
} .. '<span class="sr-only"> </span><sup>1</sup>⁄<sub>2</sub>'
end
elseif gii == '0' then
Args[prefix..'loss_'..ti] = Args[prefix..'loss_'..ti] + 1
end
Args[prefix..'match' .. game_count .. '_' .. ti .. '_' .. tj] = gii
match_str = mw.ustring.gsub(match_str, '^([^%+]*)', '') or '' -- Remove gii from the match_str
if match_str ~= '' then -- If there is still a plus sign
game_count = game_count + 1 -- Then there is another game in the match
match_str = mw.ustring.gsub(match_str, '^%+?', '') or '' -- So remove the plus sign
end -- And continue
end
if game_count > legs then -- If there are more games than expected
legs = game_count -- Change the number of games
end
end
matchrow_str = mw.ustring.gsub(matchrow_str, '^([^,]*),?', '') or ''
end
end
Args[prefix..'legs'] = legs -- And finally change the Arg at the end
end
function pp.header(t,Args,p_sub,pos_label,group_col,VTE_text,full_table,results_header_txt)
-- Load relevant modules
local yesno = require('Module:Yesno')
-- Create table header
-- Pre stuff
local player_width = Args['playerwidth'] or '190'
local sort_text = ''
local sort_table_val = Args['sortable_table'] or 'no'
if yesno(sort_table_val) then sort_text = ' sortable' end
-- Open table
table.insert(t,'{|class="wikitable'..sort_text..'" style="text-align:center;"\n')
-- Table title
if Args['title'] or Args['table_header'] then
table.insert(t,'|+ ' .. (Args['title'] or Args['table_header']) .. '\n')
end
-- Preprocess match data
local top_pos = tonumber(Args['highest_pos']) or 1
local N_teams = top_pos - 1 -- Default to 0 at start, but higher number needed to skip certain entries
while Args['team'..N_teams+1] ~= nil do N_teams = N_teams+1 end
pp.preprocess(Args,N_teams,'',yesno(Args['crosstable_fractions'] or 'no'))
local tb_numplayers = tonumber(Args['tb_numplayers']) or 0
if tb_numplayers > N_teams then
tb_numplayers = N_teams
Args['tb_numplayers'] = N_teams
end
if tb_numplayers >= 2 then
pp.preprocess(Args,tb_numplayers,'tb',yesno(Args['crosstable_fractions'] or 'no'))
end
-- Which columns to show
local show_rating = yesno(Args['show_rating'] or 'no')
local show_played = not yesno(Args['hide_played'] or 'no')
local hth_first = yesno(Args['hth_before_w'] or 'yes')
local show_hth = yesno(Args['show_hth'] or 'yes')
local show_win = yesno(Args['show_win'] or 'yes')
local show_draw = yesno(Args['show_draw'] or 'no')
local show_loss = yesno(Args['show_loss'] or 'no')
local sb_first = yesno(Args['sb_before_w'] or 'no')
local show_sb = yesno(Args['show_sb'] or 'no')
local extra_cols = tonumber(Args['extra_cols']) or 0
-- Custom header options
local group_head_text = Args['group_header'] or '<abbr title="Group">Grp</abbr>'
local player_head_text = Args['player_header'] or 'Player'
-- Initialize
local tt = {}
tt.count = 0 -- Up by one after every call
tt.tab_text = t -- Actual text
-- Actual headers
if pos_label ~= nil then
tt = p_sub.colhead(tt,28,pos_label) -- Position col
end
-- Add group header
if full_table and group_col then
tt = p_sub.colhead(tt,28,group_head_text) -- Group col
end
tt = p_sub.colhead(tt,player_width,player_head_text..VTE_text) -- Player col
if full_table and show_rating then
local rate_date = Args['rate_date'] or ''
tt = p_sub.colhead(tt,28, '[[FIDE world rankings|Rating]]<br/><small><span style="white-space:nowrap">'..rate_date..'</span></small>')
end
if show_played then
tt = p_sub.colhead(tt,28, '<abbr title="Games Played">Pld</abbr>') -- Games played col
end
tt = p_sub.colhead(tt,28, 'Score') -- Score col
if full_table then
if show_hth and hth_first then
tt = p_sub.colhead(tt,28, '<abbr title="Head-to-head">H2H</abbr>') -- Head-to-head col
end
if show_sb and sb_first then
tt = p_sub.colhead(tt,28, '<abbr title="Sonneborn–Berger score">[[Sonneborn–Berger score|SB]]</abbr>')
end
if show_win then
tt = p_sub.colhead(tt,28, 'Wins') -- Wins col
end
if show_draw then
tt = p_sub.colhead(tt,28, 'Draws') -- Draws col
end
if show_loss then
tt = p_sub.colhead(tt,28, 'Losses') -- Losses col
end
if show_hth and not hth_first then
tt = p_sub.colhead(tt,28, '<abbr title="Head-to-head">H2H</abbr>') -- Head-to-head col if not first tiebreak
end
if show_sb and not sb_first then
tt = p_sub.colhead(tt,28, '<abbr title="Sonneborn–Berger score">[[Sonneborn–Berger score|SB]]</abbr>')
end
for ecol=1,extra_cols do
local extra_head_text = Args['extra_header'..ecol] or ('Extra' .. ecol)
tt = p_sub.colhead(tt,28,extra_head_text)
end
tt.count = tt.count+1
table.insert(tt.tab_text,results_header_txt)
end
return tt
end
function pp.row(frame,t,Args,p_sub,notes_exist,hth_id_list,full_table,rand_val,team_list,team_code_ii,ii_start,ii_end,ii_fw,bg_col,N_teams,ii,ii_show)
-- Build the inner parts of individual rows
-- Sub-module usage
local mm = require('Module:Math')
local yesno = require('Module:Yesno')
-- Get custom/default options for in table
local win_points = tonumber(Args['winpoints']) or 1
local draw_points = tonumber(Args['drawpoints']) or 0.5
local loss_points = tonumber(Args['losspoints']) or 0
-- Get some input
local wins = tonumber(Args['win_'..team_code_ii]) or 0
local draws = tonumber(Args['draw_'..team_code_ii]) or 0
local losses = tonumber(Args['loss_'..team_code_ii]) or 0
local hth_local = Args['hth_'..team_code_ii] or ''
local show_rating = yesno(Args['show_rating'] or 'no')
local show_played = not yesno(Args['hide_played'] or 'no')
local score_over_played = yesno(Args['score_over_played'] or 'no')
local hth_first = yesno(Args['hth_before_w'] or 'yes')
local show_hth = yesno(Args['show_hth'] or 'yes')
local show_win = yesno(Args['show_win'] or 'yes')
local show_draw = yesno(Args['show_draw'] or 'no')
local show_loss = yesno(Args['show_loss'] or 'no')
local wdl_iff_hth = yesno(Args['wdl_iff_hth'] or 'no')
local sb_first = yesno(Args['sb_before_w'] or 'no')
local show_sb = yesno(Args['show_sb'] or 'no')
local nosb = yesno(Args['nosb_'..team_code_ii] or 'no')
local sb_iff_hth = yesno(Args['sb_iff_hth'] or 'no')
local extra_cols = tonumber(Args['extra_cols']) or 0
local disp_fractions = yesno(Args['disp_fractions'] or 'yes')
-- Then calculate some values
local matches = wins + draws + losses
local points = win_points*wins + draw_points*draws + loss_points*losses
local sb_score = 0
local templatestyles = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Screen reader-only/styles.css' }
}
hth_local = mw.ustring.gsub(hth_local, '%s*½', '.5')
if hth_local == '' then
hth_local = '—'
elseif disp_fractions then
hth_local = tonumber(hth_local) or 0
if math.floor(hth_local) ~= hth_local then
if math.floor(hth_local) > 0 then
hth_local = math.floor(hth_local) .. templatestyles .. '<span class="sr-only"> </span><sup>1</sup>⁄<sub>2</sub>'
else
hth_local = templatestyles .. '<span class="sr-only"> </span><sup>1</sup>⁄<sub>2</sub>'
end
end
end
if score_over_played then
points = '<span style="white-space:nowrap">' .. points .. ' / ' .. matches .. '</span>'
elseif disp_fractions then
if math.floor(points) ~= points then
if math.floor(points) > 0 then
points = math.floor(points) .. templatestyles .. '<span class="sr-only"> </span><sup>1</sup>⁄<sub>2</sub>'
else
points = templatestyles .. '<span class="sr-only"> </span><sup>1</sup>⁄<sub>2</sub>'
end
end
end
-- Sonneborn–Berger score
if show_sb then
if (sb_iff_hth and hth_local == '—') or nosb then
sb_score = '—'
end
if sb_score == 0 then
local legs = tonumber(Args['legs']) or 1
for jj=1,N_teams do
local tj = Args['team' .. jj]
local tjpoints = win_points*Args['win_'..tj] + draw_points*Args['draw_'..tj] + loss_points*Args['loss_'..tj]
if ii ~= jj then
local match_str = Args['match_' .. team_code_ii .. '_' .. tj] or ''
for l=1,legs do
local gii = mw.ustring.match(match_str, '^%s*([^%+%s]*)%s*%+?')
if gii == '1' then
sb_score = sb_score + win_points*tjpoints
elseif gii == '½' then
sb_score = sb_score + draw_points*tjpoints
elseif gii == '0' then
sb_score = sb_score + loss_points*tjpoints
end
match_str = mw.ustring.gsub(match_str, '^%s*([^%+%s]*)%s*%+?', '') or ''
end
end
end
end
end
-- Some local vars
local hth_string
local tt_return = p_sub.hth(frame,Args,full_table,hth_id_list,nil,notes_exist,team_list,team_code_ii,ii_start,ii_end,rand_val)
hth_string = tt_return.str
hth_id_list = tt_return.list
notes_exist = tt_return.notes_exist
-- Row building
if full_table and show_rating then
local rateii = Args['rating_'..team_code_ii] or ''
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..rateii..'\n') -- Rating
end
if show_played then
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..matches..'\n') -- Played
end
table.insert(t,'| style="font-weight: bold;'..bg_col..'" | '..points..'\n') -- Points
if full_table then
if show_hth and hth_first then
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..(hth_local or '')..'\n') -- Head-to-head
end
if show_sb and sb_first then
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..sb_score..'\n') -- Sonneborn–Berger
end
if show_win then
if wdl_iff_hth and hth_local == '—' then
wins = '—'
end
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..wins..'\n') -- Won
end
if show_draw then
if wdl_iff_hth and hth_local == '—' then
draws = '—'
end
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..draws..'\n') -- Drew
end
if show_loss then
if wdl_iff_hth and hth_local == '—' then
losses = '—'
end
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..losses..'\n') -- Lost
end
if show_hth and not hth_first then
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..(hth_local or '')..'\n') -- Head-to-head if not first tiebreak
end
if show_sb and not sb_first then
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..sb_score..'\n') -- Sonneborn–Berger
end
for ecol=1,extra_cols do
local extraii = Args['extra'..ecol..'_'..team_code_ii] or ''
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..extraii..'\n') -- Extra
end
end
return {t=t, notes_exist=notes_exist, hth_id_list=hth_id_list}
end
function pp.status(Args)
-- Declare status options
-- ------------------------------------------------------------
-- NOTE: If you add to status_code, also add to status_called and status_letters!!
-- Or functionality will be compromised
-- ------------------------------------------------------------
local status_code, status_called = {}
status_code = { A='Advance to a further round', C='Champion', D='Disqualified',
E='Eliminated', G='Guest', H='Host', O='Play-off winner', P='Promoted', Q='Qualified to the phase indicated',
R='Relegated', T='Qualified, but not yet to the particular phase indicated',
X='?', Y='?', Z='?'}
status_called = { A=false, C=false, D=false, E=false, G=false, H=false, O=false, P=false,
Q=false, R=false, T=false, X=false, Y=false, Z=false}
local status_letters = 'ACDEGHOPQRTXYZ'
-- Status position (before or after read and default)
local stat_pos_val = Args['status_pos'] or ''
local status_position = 'after' -- Default location
stat_pos_val = string.lower(stat_pos_val)
if stat_pos_val=='before' then
status_position = 'before'
elseif stat_pos_val=='after' then
status_position = 'after'
end
-- Read in custom status options
for l in mw.text.gsplit(status_letters, '') do
if Args['status_text_' .. l] then
status_code[l] = Args['status_text_' .. l]
end
end
return {code=status_code, called=status_called, letters=status_letters, position=status_position}
end
return pp