Template:Compact election box/doc
This is a documentation subpage for Template:Compact election box. It may contain usage information, categories and other content that is not part of the original template page. |
This template uses Lua: |
Purpose
editA set of templates to produce a table displaying the results of first-past-the-post elections in a more compact format than offered by {{Election box}}.
Example
editThese templates produce results like this:
Election | Political result | Candidate | Party | Votes | % | ±% | ||
---|---|---|---|---|---|---|---|---|
1953 by-election death of Sir Bufton Tufton Electorate: 57,901 Turnout: 31,432 (66.2%) | Conservative gain from SNP Majority: 2,507 (12.5%) Swing: 17.1% from SNP to Con | Jimmy Smith | Conservative | 26,241 | 50.5 | N/A | ||
Dave Spart | Labour | 10,719 | 20.1 | N/A | ||||
1955 general election Electorate: 57,901 | Conservative hold | Jimmy Smith | Conservative | unopposed | ||||
1959 general election Electorate: 57,901 Turnout: 31,432 (66.2%) | Conservative hold Majority: 12,952 (19.5%) | Jimmy Smith | Conservative | 27,709 | 54.5 | N/A | ||
Dave Spart | Labour | 8,604 | 16.2 | N/A | ||||
Eric The Viking | Vikings for Borsetshire | 6,903 | 12.5 | N/A | ||||
1964 general election Electorate: 62,184 Turnout: 41,401 (69.8%) +3.6 | Labour gain from Conservative Majority: 2,011 (9.5%) | Dave Spart | Labour | 20,591 | 38.9 | +22.7 | ||
Jimmy Smith | Conservative | 18,709 | 33.4 | −22.1 | ||||
Col. Theo Smithers | Borsetshire Ratepayers | 1,903 | 6.7 | N/A | ||||
William Williamson | Liberal | 1,812 | 6.4 | N/A | ||||
Verte Profonde | Green | 1,561 | 6.0 | N/A | ||||
Egbert Monster | Monster Raving Loony | 912 | 3.1 | N/A | ||||
A. N. Ulsterman | UUP | 874 | 2.7 | N/A | ||||
A. Alba | SNP | 540 | 2.3 | N/A | ||||
1966 general election Electorate: 62,184 Turnout: 41,401 (69.8%) | Labour hold Majority: 2,011 (9.5%) +1.4 | Dave Spart | Labour | 20,591 | 39.9 | +1.1 | ||
Jimmy Smith | Conservative | 18,709 | 32.3 | −1.1 | ||||
Col. Theo Smithers | Borsetshire Ratepayers | 1,903 | 6.7 |
Usage
edit{{Compact election box begin}}
{{Compact election box}}
{{Compact election box}}
{{Compact election box}}
...
{{Compact election box end}}
Simple usage
editBlank example with basic parameters
{{Compact election box begin}}
{{Compact election box
| election_title =
| winner =
| winner_party =
| winner_votes =
| winner_percent =
| winner_change =
| candidate2 =
| candidate2_party =
| candidate2_votes =
| candidate2_percent =
| candidate2_change =
}}
{{Compact election box end}}
Full usage
editBlank example with all parameters
{{Compact election box begin}}
{{Compact election box
| election_title =
| election_note =
| election_ref =
| anchor =
| anchor2 =
| anchor3 =
| electorate =
| turnout_votes =
| turnout_percent =
| turnout_change =
| majority_votes =
| majority_percent =
| majority_change =
| result =
| loser_party =
| loser_party_unlinked =
| swing =
| swing_from =
| swing_to =
| winner =
| winner_party =
| winner_party_unlinked =
| winner_votes =
| winner_percent =
| winner_change =
| candidate2 =
| candidate2_party =
| candidate2_party_unlinked =
| candidate2_votes =
| candidate2_percent =
| candidate2_change =
| candidate3 =
| candidate3_party =
| candidate3_party_unlinked =
| candidate3_votes =
| candidate3_percent =
| candidate3_change =
| candidate4 =
| candidate4_party =
| candidate4_party_unlinked =
| candidate4_votes =
| candidate4_percent =
| candidate4_change =
| candidate5 =
| candidate5_party =
| candidate5_party_unlinked =
| candidate5_votes =
| candidate5_percent =
| candidate5_change =
| candidate6 =
| candidate6_party =
| candidate6_party_unlinked =
| candidate6_votes =
| candidate6_percent =
| candidate6_change =
| candidate7 =
| candidate7_party =
| candidate7_party_unlinked =
| candidate7_votes =
| candidate7_percent =
| candidate7_change =
| candidate8 =
| candidate8_party =
| candidate8_party_unlinked =
| candidate8_votes =
| candidate8_percent =
| candidate8_change =
| candidate9 =
| candidate9_party =
| candidate9_party_unlinked =
| candidate9_votes =
| candidate9_percent =
| candidate9_change =
| candidate10 =
| candidate10_party =
| candidate10_party_unlinked =
| candidate10_votes =
| candidate10_percent =
| candidate10_change =
| candidate11 =
| candidate11_party =
| candidate11_party_unlinked =
| candidate11_votes =
| candidate11_percent =
| candidate11_change =
| candidate12 =
| candidate12_party =
| candidate12_party_unlinked =
| candidate12_votes =
| candidate12_percent =
| candidate12_change =
| candidate13 =
| candidate13_party =
| candidate13_party_unlinked =
| candidate13_votes =
| candidate13_percent =
| candidate13_change =
| candidate14 =
| candidate14_party =
| candidate14_party_unlinked =
| candidate14_votes =
| candidate14_percent =
| candidate14_change =
| candidate15 =
| candidate15_party =
| candidate15_party_unlinked =
| candidate15_votes =
| candidate15_percent =
| candidate15_change =
| candidate16 =
| candidate16_party =
| candidate16_party_unlinked =
| candidate16_votes =
| candidate16_percent =
| candidate16_change =
| candidate17 =
| candidate17_party =
| candidate17_party_unlinked =
| candidate17_votes =
| candidate17_percent =
| candidate17_change =
| candidate18 =
| candidate18_party =
| candidate18_party_unlinked =
| candidate18_votes =
| candidate18_percent =
| candidate18_change =
| candidate19 =
| candidate19_party =
| candidate19_party_unlinked =
| candidate19_votes =
| candidate19_percent =
| candidate19_change =
| candidate20 =
| candidate20_party =
| candidate20_party_unlinked =
| candidate20_votes =
| candidate20_percent =
| candidate20_change =
| candidate21 =
| candidate21_party =
| candidate21_party_unlinked =
| candidate21_votes =
| candidate21_percent =
| candidate21_change =
| candidate22 =
| candidate22_party =
| candidate22_party_unlinked =
| candidate22_votes =
| candidate22_percent =
| candidate22_change =
| candidate23 =
| candidate23_party =
| candidate23_party_unlinked =
| candidate23_votes =
| candidate23_percent =
| candidate23_change =
| candidate24 =
| candidate24_party =
| candidate24_party_unlinked =
| candidate24_votes =
| candidate24_percent =
| candidate24_change =
| candidate25 =
| candidate25_party =
| candidate25_party_unlinked =
| candidate25_votes =
| candidate25_percent =
| candidate25_change =
| candidate26 =
| candidate26_party =
| candidate26_party_unlinked =
| candidate26_votes =
| candidate26_percent =
| candidate26_change =
| candidate27 =
| candidate27_party =
| candidate27_party_unlinked =
| candidate27_votes =
| candidate27_percent =
| candidate27_change =
| candidate28 =
| candidate28_party =
| candidate28_party_unlinked =
| candidate28_votes =
| candidate28_percent =
| candidate28_change =
| candidate29 =
| candidate29_party =
| candidate29_party_unlinked =
| candidate29_votes =
| candidate29_percent =
| candidate29_change =
| candidate30 =
| candidate30_party =
| candidate30_party_unlinked =
| candidate30_votes =
| candidate30_percent =
| candidate30_change =
| candidate31 =
| candidate31_party =
| candidate31_party_unlinked =
| candidate31_votes =
| candidate31_percent =
| candidate31_change =
| candidate32 =
| candidate32_party =
| candidate32_party_unlinked =
| candidate32_votes =
| candidate32_percent =
| candidate32_change =
| candidate33 =
| candidate33_party =
| candidate33_party_unlinked =
| candidate33_votes =
| candidate33_percent =
| candidate33_change =
| candidate34 =
| candidate34_party =
| candidate34_party_unlinked =
| candidate34_votes =
| candidate34_percent =
| candidate34_change =
| candidate35 =
| candidate35_party =
| candidate35_party_unlinked =
| candidate35_votes =
| candidate35_percent =
| candidate35_change =
| candidate36 =
| candidate36_party =
| candidate36_party_unlinked =
| candidate36_votes =
| candidate36_percent =
| candidate36_change =
| candidate37 =
| candidate37_party =
| candidate37_party_unlinked =
| candidate37_votes =
| candidate37_percent =
| candidate37_change =
| candidate38 =
| candidate38_party =
| candidate38_party_unlinked =
| candidate38_votes =
| candidate38_percent =
| candidate38_change =
| candidate39 =
| candidate39_party =
| candidate39_party_unlinked =
| candidate39_votes =
| candidate39_percent =
| candidate39_change =
| candidate40 =
| candidate40_party =
| candidate40_party_unlinked =
| candidate40_votes =
| candidate40_percent =
| candidate40_change =
| candidate41 =
| candidate41_party =
| candidate41_party_unlinked =
| candidate41_votes =
| candidate41_percent =
| candidate41_change =
| candidate42 =
| candidate42_party =
| candidate42_party_unlinked =
| candidate42_votes =
| candidate42_percent =
| candidate42_change =
| candidate43 =
| candidate43_party =
| candidate43_party_unlinked =
| candidate43_votes =
| candidate43_percent =
| candidate43_change =
| candidate44 =
| candidate44_party =
| candidate44_party_unlinked =
| candidate44_votes =
| candidate44_percent =
| candidate44_change =
| candidate45 =
| candidate45_party =
| candidate45_party_unlinked =
| candidate45_votes =
| candidate45_percent =
| candidate45_change =
| candidate46 =
| candidate46_party =
| candidate46_party_unlinked =
| candidate46_votes =
| candidate46_percent =
| candidate46_change =
| candidate47 =
| candidate47_party =
| candidate47_party_unlinked =
| candidate47_votes =
| candidate47_percent =
| candidate47_change =
| candidate48 =
| candidate48_party =
| candidate48_party_unlinked =
| candidate48_votes =
| candidate48_percent =
| candidate48_change =
| candidate49 =
| candidate49_party =
| candidate49_party_unlinked =
| candidate49_votes =
| candidate49_percent =
| candidate49_change =
| candidate50 =
| candidate50_party =
| candidate50_party_unlinked =
| candidate50_votes =
| candidate50_percent =
| candidate50_change =
}}
{{Compact election box end}}
Parameters
editHeader parameters
editThe parameters are used once
Parameter | Purpose | Example1 | Example2 |
---|---|---|---|
Required parameters | |||
election_title | title of election, may be wikilinked | [[Foobar South-Central by-election, 1953|1953 by-election]] | [[United Kingdom election, 1951|1951]] |
Optional parameters | |||
anchor, anchor2, anchor3 | a HTML anchor, to allow direct linking to the results for a particular election | anchor=GE2020result | anchor2=1917byelection |
election_ref | reference, usually to the source of the results | <ref>[http://www.foobar-politics-today.com Foobar South-Central by-election results], Politics Today</ref> | <ref name="somesource" /> |
election_note | very short note on the election. Probably best kept to a terse reason for a by-election | death of [[Sir Bufton Tufton]] | resignation of [[Jane Imefedup]] |
electorate | number of registered voters | 57,901 | |
turnout_votes | Number of ballots cast | 31,432 | |
turnout_percent | Turnout as a percentage of registered electors | 20.5 | 8.76 |
turnout_change | Change in turnout as a percentage of registered electors | +1.2 | −5.3 |
majority_votes | majority of the winning candidate in number of votes | 1,607 | |
majority_percent | Majority as a percentage of valid votes | +6.1 | −3.7 |
majority_change | Change in majority as a percentage of valid votes | +1.2 | −5.3 |
result | whether the seat changed party | hold, or gain (default=win) | |
loser_party | name of the party which lost, to be wikilinked | Social Democratic Party (UK) | Labour Party (UK) |
loser_party_unlinked | name of the party which lost, will not be wikilinked | Let's have a party all night Party | |
swing | swing in percentage | 4.3 | −6.8 |
swing_from | party which votes swung away from | Labour Party (UK) | |
swing_to | party which votes swung away from | Conservative Party (UK) |
Winner parameters
editOne set of these parameters for each candidate
Parameter | Purpose | Example |
---|---|---|
winner | Name of candidate (may be wikilinked) | [[Jimmy Abdul Rudigger Smith (junior)|Jimmy Smith]] |
winner_party | name of article on party | Conservative Party (UK) |
winner_party_unlinked | text of article on party | Borsetshire Free Lunch Party |
winner_votes | Number of votes received by the candidate | 26,241 |
winner_percent | Percentage of votes received by the candidate | 50.5 |
winner_change | Change in that party's percentage share of votes | −0.5 |
Candidate parameters
editOne set of these parameters for each candidate, starting candidate2. Maximum of 25.
Parameter | Purpose | Example |
---|---|---|
candidaten | Name of candidate (may be wikilinked) | [[Jimmy Abdul Rudigger Smith (junior)|Jimmy Smith]] |
candidaten_party | name of article on party | Conservative Party (UK) |
candidaten_party_unlinked | text of article on party | Borsetshire Free Lunch Party |
candidaten_votes | Number of votes received by the candidate | 26,241 |
candidaten_percent | Percentage of votes received by the candidate | 50.5 |
candidaten_change | Change in that party's percentage share of votes | +1.6 |
Anchors
editBy default, the template creates two anchors to the results of that election, using the following formats:
<election name as displayed> result
,<election name as displayed> result
, all converted to lowercase
So for example, on Bradford West (UK Parliament constituency), the table row for the 1970 general election has the automatically-generated anchors General election 1970 result
and general election 1970 result
. They can be can be linked to as Bradford West (UK Parliament constituency)#General election 1970 result and Bradford West (UK Parliament constituency)#general election 1970 result
Custom anchors
editIn addition to the auto-generated anchors, up to 3 custom anchors may be added using the parameters |anchor=
, |anchor2=
, and |anchor3=
.
For example, on Bradford Central (UK Parliament constituency), the entry for the 1886 by-election has the parameter |anchor=1886 unopposed
... which allows a link to Bradford Central (UK Parliament constituency)#1886 unopposed