Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a3ff15748bef3564

Jump to content

Module:Sports table/auto/doc

From Wikipedia, the free encyclopedia

This is a supporting module of Module:Sports table which helps automatically generate the standings of a sports competition based on the match results.

Purpose

[edit]

Normally, Module:Sports table is generated by entering in the record for all teams (for example |win_TTT=, |draw_TTT=, |loss_TTT=, |gf_TTT=, |ga_TTT=) as well as the positions of all teams (|teamN=TTT or |team_order=AAA, BBB, TTT, ...). Results for specific matches can also be shown alongside the standings (example), which relies on Module:Sports results; that module can also be called directly for standalone usage.

When using the "auto" mode, the match results themselves are used to generate the record for each team (the parameters that set the record of each team are ignored). Then, using tiebreakers specified by the user, the "auto" mode will determine the exact ranking of teams. Thus, only the score of a match needs to be added to update the standings. Tiebreakers that cannot be inferred by the match scores (like disciplinary points or coefficients) are not supported; these teams must have their positions manually set (otherwise they will be displayed by the module as tied).

Tables using the prior format are unaffected; this feature must be explicitly called using |auto_generate_standings=yes. The |auto_generate_standings= feature is currently supported by |style=WDL, |style=WL, |style=WDLHA and |style=WLHA

Features

[edit]

Ranking criteria

[edit]

The ranking criteria are passed via the |auto_generate_criteria= parameter, comma-separated. If the parameter is omitted, the default is pts, gd, gf.

By default, values sort from highest to lowest. A minus sign in front of an identifier sorts from lowest to highest.

Identifiers for the ranking criteria
Identifier Description
pts points
w wins
d draws
l losses
gf goals for
ga goals against
gd goal difference
gr goal ratio
gp goal percentage
ap against percentage
pp point percentage
gpm goals per match
wp win percentage
perc percentage
ppg points per game

Prefix any criterion with h or a to count only that team's home or away record for the statistic, e.g. |ranking_criteria=hpts (home points), |ranking_criteria=agf (away goals for), |ranking_criteria=awp (away win percentage). Without the prefix, the full/overall record is used.

The following prefixes are also available:

  • h2h_: the same statistic counted only from the matches played between the teams that are still tied (e.g. h2h_pts, h2h_gd, h2h_gf, h2h_hpts).
    • By default, this is calculated even if all the head-to-head matches between the tied teams have not yet been played. To skip over the head-to-head criteria until all relevant matches have been played, set |h2h_after_complete=yes. To stop before the head-to-head criteria until all relevant matches have been played, set |h2h_after_complete=freeze.
  • opp_: the combined full-season record of that statistic for every opponent a team has faced (e.g. opp_pts, opp_gd, opp_gf, opp_agpm). Note that an opponent met twice counts twice.

The home/away modifier and the scope prefix can be combined; the scope prefix comes first, e.g. |ranking_criteria=h2h_hpts is head-to-head home points, and |ranking_criteria=opp_agd is the away goal difference aggregated across a team's opponents.

Teams with no value for a criterion (e.g. a percentage with no matches played) sort below teams that have a value. A goal ratio with goals scored and none conceded counts as the highest possible value.

Note that the table will not generate tiebreaker footnotes; this still must be manually set with |hth_TTT=. Nor will it set the classification rules text displayed to readers; this must be defined with |class_rules=.

Recursive criteria

Certain competitions recursively apply head-to-head criteria. To support this, this module applies criteria inside parentheses as a group, and the group starts again from the beginning for any set of teams that remain level upon reaching the end of the group. Therefore, if the group separates some of the tied teams but leaves others level, the head-to-head standings are recalculated from just the matches played between the teams that remain tied. This repeats until no further progress is made, at which point the criteria after the parentheses are applied.

Criteria used only at the end of the season

A full stop can be used to delineate between criteria that apply during the season, and criteria that only apply after the completion of the competition when |update=complete. For example, |auto_generate_criteria=pts, gd, gf. h2h_pts, h2h_gd, h2h_gf means that the head-to-head criteria only apply after the completion of the season.

Order and position of teams

[edit]

If, after applying the tiebreaker criteria, two or more teams remain level, they will share a position in the table. If |default_order=AAA, BBB, CCC, ... is provided, it will determine the order in which they appear. Codes left out are added at the end in alphabetical order by team name; if the parameter is omitted, all teams are ordered that way. The name used for sorting is the plain text of |name_AAA=; if this is omitted, or two teams share the same name, the code itself is used to determine the order.

Override the calculated order

The order of teams that the module generates can be overridden in two ways:

  • |team_order=AAA, BBB, CCC, ...: determines the entire order of the standings
  • |teamN=AAA: moves team AAA to position N
    • This option allows for manually setting the position of some teams without listing them all. However, every team that is displaced has to be given a position of its own. Setting |team3=CCC alone does not work, because whatever team was third has nowhere to go. If the order cannot be resolved, an error will be displayed when previewing the page, and the module will default to the auto-calculated order.

If both are set, |team_order= takes precedence.

Value in the position column

After applying all criteria, teams that remain level share the same position number. This can be disabled using |show_tied_positions=no.

A tied group loses its shared number if |teamN= is used to reorder any team(s) in it, though other tied groups in the same table are unaffected. The parameter |team_order= removes shared numbering for the entire table.

As with the standard use of Module:Sports table, |pos_TTT= will override the text in the position column for a single team, and does not change where that team appears in the table.

Handling of match results

[edit]

As with the standard use of Module:Sports table, the match results can be displayed in the output by relying on Module:Sports results. The following options are available:

Options for the results output
Parameter value Description
|show_matches=no or omitted standings only
|show_matches=yes standings with the results grid built into the same table
|show_matches=only the results grid on its own, no standings
|show_matches=below standings, then a level-two heading, then the results grid
|show_matches=below_levelN standings, then a heading, then the results grid with a level N heading

Setting the parameter |show_matches=only while using transclulsion allows for the results grid to be output in that instance, while letting the standings table to be output in other transclusions.

For |show_matches=below and |show_matches=below_levelN, the parameter |below_results_header= can be used to set a custom heading (default is "Results").

The order of teams in the results grid (for both |show_matches=only and |show_matches=below/|show_matches=below_levelN) is determined by |default_order=. If not set, the order is then alphabetical by the team's plain text name; if this is omitted, or two teams share the same name, the code itself is used to determine the order.

Conflicting parameters

As the parameters |title= and |team_header= conflict between Module:Sports series and Module:Sports results, the following parameters are used when |show_matches=only or |show_matches=below:

  • |matches_title=: caption for the results grid
  • |matches_team_header=: text for the corner cell, replacing "Home \ Away"
  • |matches_source=: an alternate source for the results grid, overriding |source= (the default for the sports table and result outputs).
  • |matches_note_TTT=: adds a note for team TTT in the results grid; |matches_note_TTT=note_TTT can be used to explicitly reuse that team's note from the standings table.
  • |matches_team_notes=yes: passes the notes of all teams (|note_TTT=) used in the standings table to the results grid. By default, these notes only appears in the standings table.

Usage

[edit]

Basic usage

[edit]
What you type
{{#invoke:Sports table|main|style=WDL
|auto_generate_standings=yes
|ranking_criteria=pts, (h2h_pts, h2h_gd, h2h_gf, h2h_agf), gd, gf, agf

|update=complete
|source=UEFA

|name_BIH={{fb|BIH}} |short_BIH={{fbicon|BIH}}
|name_BEL={{fb|BEL}} |short_BEL={{fbicon|BEL}}
|name_ISR={{fb|ISR}} |short_ISR={{fbicon|ISR}}
|name_WAL={{fb|WAL}} |short_WAL={{fbicon|WAL}}
|name_CYP={{fb|CYP}} |short_CYP={{fbicon|CYP}}
|name_AND={{fb|AND}} |short_AND={{fbicon|AND}}

|result1=Q |result2=Q |result3=PO
|res_col_header=Q
|col_Q=green1 |text_Q=Qualify for [[UEFA Euro 2016|final tournament]]
|col_PO=blue1 |text_PO=Advance to [[UEFA Euro 2016 qualifying play-offs|play-offs]]

|match_BIH_BEL=1–1
|match_BIH_ISR=3–1
|match_BIH_WAL=2–0
|match_BIH_CYP=1–2
|match_BIH_AND=3–0

|match_BEL_BIH=3–1
|match_BEL_ISR=3–1
|match_BEL_WAL=0–0
|match_BEL_CYP=5–0
|match_BEL_AND=6–0

|match_ISR_BIH=3–0
|match_ISR_BEL=0–1
|match_ISR_WAL=0–3
|match_ISR_CYP=1–2
|match_ISR_AND=4–0

|match_WAL_BIH=0–0
|match_WAL_BEL=1–0
|match_WAL_ISR=0–0
|match_WAL_CYP=2–1
|match_WAL_AND=2–0

|match_CYP_BIH=2–3
|match_CYP_BEL=0–1
|match_CYP_ISR=1–2
|match_CYP_WAL=0–1
|match_CYP_AND=5–0

|match_AND_BIH=0–3
|match_AND_BEL=1–4
|match_AND_ISR=1–4
|match_AND_WAL=1–2
|match_AND_CYP=1–3
}}
What it looks like
Pos Team Pld W D L GF GA GD Pts Qualification
1  Belgium 10 7 2 1 24 5 +19 23 Qualify for final tournament
2  Wales 10 6 3 1 11 4 +7 21
3  Bosnia and Herzegovina 10 5 2 3 17 12 +5 17 Advance to play-offs
4  Israel 10 4 1 5 16 14 +2 13
5  Cyprus 10 4 0 6 16 17 1 12
6  Andorra 10 0 0 10 4 36 32 0
Source: UEFA

Example with position swap

[edit]
What you type
{{#invoke:Sports table|main|style=WDL
|auto_generate_standings=yes
|ranking_criteria=pts, (h2h_pts, h2h_gd, h2h_gf, h2h_agf), gd, gf, agf

|update=complete
|source=UEFA

|team1=BIH |team3=BEL

|name_BIH={{fb|BIH}} |short_BIH={{fbicon|BIH}}
|name_BEL={{fb|BEL}} |short_BEL={{fbicon|BEL}}
|name_ISR={{fb|ISR}} |short_ISR={{fbicon|ISR}}
|name_WAL={{fb|WAL}} |short_WAL={{fbicon|WAL}}
|name_CYP={{fb|CYP}} |short_CYP={{fbicon|CYP}}
|name_AND={{fb|AND}} |short_AND={{fbicon|AND}}

|result1=Q |result2=Q |result3=PO
|res_col_header=Q
|col_Q=green1 |text_Q=Qualify for [[UEFA Euro 2016|final tournament]]
|col_PO=blue1 |text_PO=Advance to [[UEFA Euro 2016 qualifying play-offs|play-offs]]

|match_BIH_BEL=1–1
|match_BIH_ISR=3–1
|match_BIH_WAL=2–0
|match_BIH_CYP=1–2
|match_BIH_AND=3–0

|match_BEL_BIH=3–1
|match_BEL_ISR=3–1
|match_BEL_WAL=0–0
|match_BEL_CYP=5–0
|match_BEL_AND=6–0

|match_ISR_BIH=3–0
|match_ISR_BEL=0–1
|match_ISR_WAL=0–3
|match_ISR_CYP=1–2
|match_ISR_AND=4–0

|match_WAL_BIH=0–0
|match_WAL_BEL=1–0
|match_WAL_ISR=0–0
|match_WAL_CYP=2–1
|match_WAL_AND=2–0

|match_CYP_BIH=2–3
|match_CYP_BEL=0–1
|match_CYP_ISR=1–2
|match_CYP_WAL=0–1
|match_CYP_AND=5–0

|match_AND_BIH=0–3
|match_AND_BEL=1–4
|match_AND_ISR=1–4
|match_AND_WAL=1–2
|match_AND_CYP=1–3
}}
What it looks like
Pos Team Pld W D L GF GA GD Pts Qualification
1  Bosnia and Herzegovina 10 5 2 3 17 12 +5 17 Qualify for final tournament
2  Wales 10 6 3 1 11 4 +7 21
3  Belgium 10 7 2 1 24 5 +19 23 Advance to play-offs
4  Israel 10 4 1 5 16 14 +2 13
5  Cyprus 10 4 0 6 16 17 1 12
6  Andorra 10 0 0 10 4 36 32 0
Source: UEFA

Example with default_order

[edit]
What you type
{{#invoke:Sports table|main|style=WDL
|auto_generate_standings=yes
|ranking_criteria=pts, (h2h_pts, h2h_gd, h2h_gf), gd, gf, agf, w, aw

|short_style=noflag
|source=UEFA
|update=future |start_date=20 September 2023

|default_order=BAY, MUN, CPH, GAL

|name_BAY={{fbaicon|GER}} [[FC Bayern Munich|Bayern Munich]]
|name_MUN={{fbaicon|ENG}} [[Manchester United F.C.|Manchester United]]
|name_CPH={{fbaicon|DEN}} [[F.C. Copenhagen|Copenhagen]]
|name_GAL={{fbaicon|TUR}} [[Galatasaray S.K. (football)|Galatasaray]]

|res_col_header=Q
|result1=KO |result2=KO |result3=EL
|col_KO=green1 |text_KO=Advance to [[2023–24 UEFA Champions League knockout phase|knockout phase]]
|col_EL=blue1 |text_EL=Transfer to [[2023–24 UEFA Europa League knockout phase#Knockout round play-offs|Europa League]]
}}
What it looks like
Pos Team Pld W D L GF GA GD Pts Qualification
1 Germany Bayern Munich 0 0 0 0 0 0 0 0 Advance to knockout phase
1 England Manchester United 0 0 0 0 0 0 0 0
1 Denmark Copenhagen 0 0 0 0 0 0 0 0 Transfer to Europa League
1 Turkey Galatasaray 0 0 0 0 0 0 0 0
First match(es) will be played: 20 September 2023. Source: UEFA

Example with default_order and show_tied_positions=no

[edit]
What you type
{{#invoke:Sports table|main|style=WDL
|auto_generate_standings=yes
|ranking_criteria=pts, (h2h_pts, h2h_gd, h2h_gf), gd, gf, agf, w, aw
|show_tied_positions=no

|short_style=noflag
|source=UEFA
|update=future |start_date=20 September 2023

|default_order=BAY, MUN, CPH, GAL

|name_BAY={{fbaicon|GER}} [[FC Bayern Munich|Bayern Munich]]
|name_MUN={{fbaicon|ENG}} [[Manchester United F.C.|Manchester United]]
|name_CPH={{fbaicon|DEN}} [[F.C. Copenhagen|Copenhagen]]
|name_GAL={{fbaicon|TUR}} [[Galatasaray S.K. (football)|Galatasaray]]

|res_col_header=Q
|result1=KO |result2=KO |result3=EL
|col_KO=green1 |text_KO=Advance to [[2023–24 UEFA Champions League knockout phase|knockout phase]]
|col_EL=blue1 |text_EL=Transfer to [[2023–24 UEFA Europa League knockout phase#Knockout round play-offs|Europa League]]
}}
What it looks like
Pos Team Pld W D L GF GA GD Pts Qualification
1 Germany Bayern Munich 0 0 0 0 0 0 0 0 Advance to knockout phase
2 England Manchester United 0 0 0 0 0 0 0 0
3 Denmark Copenhagen 0 0 0 0 0 0 0 0 Transfer to Europa League
4 Turkey Galatasaray 0 0 0 0 0 0 0 0
First match(es) will be played: 20 September 2023. Source: UEFA

Example with show_matches=yes

[edit]
What you type
{{#invoke:Sports table|main|style=WDL
|auto_generate_standings=yes
|ranking_criteria=pts, (h2h_pts, h2h_gd, h2h_gf, h2h_agf), gd, gf, agf

|update=complete
|source=UEFA
|show_matches=yes

|name_ESP={{fb|ESP}} |short_ESP={{fbicon|ESP}}
|name_UKR={{fb|UKR}} |short_UKR={{fbicon|UKR}}
|name_SVK={{fb|SVK}} |short_SVK={{fbicon|SVK}}
|name_BLR={{fb|BLR}} |short_BLR={{fbicon|BLR}}
|name_MKD={{fb|MKD|name=Macedonia}} |short_MKD={{fbicon|MKD}}
|name_LUX={{fb|LUX}} |short_LUX={{fbicon|LUX}}

|hth_LUX=Tied on head-to-head points (3) and head-to-head goal difference (0). Head-to-head away goals: Luxembourg 2, Macedonia 0. |hth_MKD=LUX

|result1=Q |result2=Q |result3=PO
|res_col_header=Q
|col_Q=green1 |text_Q=Qualify for [[UEFA Euro 2016|final tournament]]
|col_PO=blue1 |text_PO=Advance to [[UEFA Euro 2016 qualifying play-offs|play-offs]]

|match_ESP_UKR=1–0
|match_ESP_SVK=2–0
|match_ESP_BLR=3–0
|match_ESP_MKD=5–1
|match_ESP_LUX=4–0

|match_UKR_ESP=0–1
|match_UKR_SVK=0–1
|match_UKR_BLR=3–1
|match_UKR_MKD=1–0
|match_UKR_LUX=3–0

|match_SVK_ESP=2–1
|match_SVK_UKR=0–0
|match_SVK_BLR=0–1
|match_SVK_MKD=2–1
|match_SVK_LUX=3–0

|match_BLR_ESP=0–1
|match_BLR_UKR=0–2
|match_BLR_SVK=1–3
|match_BLR_MKD=0–0
|match_BLR_LUX=2–0

|match_MKD_ESP=0–1
|match_MKD_UKR=0–2
|match_MKD_SVK=0–2
|match_MKD_BLR=1–2
|match_MKD_LUX=3–2

|match_LUX_ESP=0–4
|match_LUX_UKR=0–3
|match_LUX_SVK=2–4
|match_LUX_BLR=1–1
|match_LUX_MKD=1–0
}}
What it looks like
Pos Team Pld W D L GF GA GD Pts Qualification Spain Slovakia Ukraine Belarus Luxembourg North Macedonia
1  Spain 10 9 0 1 23 3 +20 27 Qualify for final tournament 2–0 1–0 3–0 4–0 5–1
2  Slovakia 10 7 1 2 17 8 +9 22 2–1 0–0 0–1 3–0 2–1
3  Ukraine 10 6 1 3 14 4 +10 19 Advance to play-offs 0–1 0–1 3–1 3–0 1–0
4  Belarus 10 3 2 5 8 14 6 11 0–1 1–3 0–2 2–0 0–0
5  Luxembourg 10 1 1 8 6 27 21 4[a] 0–4 2–4 0–3 1–1 1–0
6  Macedonia 10 1 1 8 6 18 12 4[a] 0–1 0–2 0–2 1–2 3–2
Source: UEFA
Notes:
  1. 1 2 Tied on head-to-head points (3) and head-to-head goal difference (0). Head-to-head away goals: Luxembourg 2, Macedonia 0.

Example with show_matches=only

[edit]
What you type
{{#invoke:Sports table|main|style=WDL
|auto_generate_standings=yes
|ranking_criteria=pts, (h2h_pts, h2h_gd, h2h_gf, h2h_agf), gd, gf, agf

|update=complete
|source=UEFA
|show_matches=only

|name_ESP={{fb|ESP}} |short_ESP={{fbicon|ESP}}
|name_UKR={{fb|UKR}} |short_UKR={{fbicon|UKR}}
|name_SVK={{fb|SVK}} |short_SVK={{fbicon|SVK}}
|name_BLR={{fb|BLR}} |short_BLR={{fbicon|BLR}}
|name_MKD={{fb|MKD|name=Macedonia}} |short_MKD={{fbicon|MKD}}
|name_LUX={{fb|LUX}} |short_LUX={{fbicon|LUX}}

|hth_LUX=Tied on head-to-head points (3) and head-to-head goal difference (0). Head-to-head away goals: Luxembourg 2, Macedonia 0. |hth_MKD=LUX

|result1=Q |result2=Q |result3=PO
|res_col_header=Q
|col_Q=green1 |text_Q=Qualify for [[UEFA Euro 2016|final tournament]]
|col_PO=blue1 |text_PO=Advance to [[UEFA Euro 2016 qualifying play-offs|play-offs]]

|match_ESP_UKR=1–0
|match_ESP_SVK=2–0
|match_ESP_BLR=3–0
|match_ESP_MKD=5–1
|match_ESP_LUX=4–0

|match_UKR_ESP=0–1
|match_UKR_SVK=0–1
|match_UKR_BLR=3–1
|match_UKR_MKD=1–0
|match_UKR_LUX=3–0

|match_SVK_ESP=2–1
|match_SVK_UKR=0–0
|match_SVK_BLR=0–1
|match_SVK_MKD=2–1
|match_SVK_LUX=3–0

|match_BLR_ESP=0–1
|match_BLR_UKR=0–2
|match_BLR_SVK=1–3
|match_BLR_MKD=0–0
|match_BLR_LUX=2–0

|match_MKD_ESP=0–1
|match_MKD_UKR=0–2
|match_MKD_SVK=0–2
|match_MKD_BLR=1–2
|match_MKD_LUX=3–2

|match_LUX_ESP=0–4
|match_LUX_UKR=0–3
|match_LUX_SVK=2–4
|match_LUX_BLR=1–1
|match_LUX_MKD=1–0
}}
What it looks like
Home \ Away Belarus Luxembourg North Macedonia Slovakia Spain Ukraine
 Belarus 2–0 0–0 1–3 0–1 0–2
 Luxembourg 1–1 1–0 2–4 0–4 0–3
 Macedonia 1–2 3–2 0–2 0–1 0–2
 Slovakia 0–1 3–0 2–1 2–1 0–0
 Spain 3–0 4–0 5–1 2–0 1–0
 Ukraine 3–1 3–0 1–0 0–1 0–1
Source: UEFA

Example ranked lowest to highest

[edit]
What you type
{{#invoke:Sports table|main|style=WDL
|auto_generate_standings=yes
|ranking_criteria=-pts, -gd, -gf

|update=complete
|source=UEFA

|name_BIH={{fb|BIH}} |short_BIH={{fbicon|BIH}}
|name_BEL={{fb|BEL}} |short_BEL={{fbicon|BEL}}
|name_ISR={{fb|ISR}} |short_ISR={{fbicon|ISR}}
|name_WAL={{fb|WAL}} |short_WAL={{fbicon|WAL}}
|name_CYP={{fb|CYP}} |short_CYP={{fbicon|CYP}}
|name_AND={{fb|AND}} |short_AND={{fbicon|AND}}

|result1=Q |result2=Q |result3=PO
|res_col_header=Q
|col_Q=green1 |text_Q=Qualify for [[UEFA Euro 2016|final tournament]]
|col_PO=blue1 |text_PO=Advance to [[UEFA Euro 2016 qualifying play-offs|play-offs]]

|match_BIH_BEL=1–1
|match_BIH_ISR=3–1
|match_BIH_WAL=2–0
|match_BIH_CYP=1–2
|match_BIH_AND=3–0

|match_BEL_BIH=3–1
|match_BEL_ISR=3–1
|match_BEL_WAL=0–0
|match_BEL_CYP=5–0
|match_BEL_AND=6–0

|match_ISR_BIH=3–0
|match_ISR_BEL=0–1
|match_ISR_WAL=0–3
|match_ISR_CYP=1–2
|match_ISR_AND=4–0

|match_WAL_BIH=0–0
|match_WAL_BEL=1–0
|match_WAL_ISR=0–0
|match_WAL_CYP=2–1
|match_WAL_AND=2–0

|match_CYP_BIH=2–3
|match_CYP_BEL=0–1
|match_CYP_ISR=1–2
|match_CYP_WAL=0–1
|match_CYP_AND=5–0

|match_AND_BIH=0–3
|match_AND_BEL=1–4
|match_AND_ISR=1–4
|match_AND_WAL=1–2
|match_AND_CYP=1–3
}}
What it looks like
Pos Team Pld W D L GF GA GD Pts Qualification
1  Andorra 10 0 0 10 4 36 32 0 Qualify for final tournament
2  Cyprus 10 4 0 6 16 17 1 12
3  Israel 10 4 1 5 16 14 +2 13 Advance to play-offs
4  Bosnia and Herzegovina 10 5 2 3 17 12 +5 17
5  Wales 10 6 3 1 11 4 +7 21
6  Belgium 10 7 2 1 24 5 +19 23
Source: UEFA

See also

[edit]