Template:Malaysian election result/total/sandbox
|- style="background-color:white" |colspan=3 style="text-align:right;border-top:1px solid darkgray;"| |style="text-align:right;border-top:1px solid darkgray;"|
![]() | This is the template sandbox page for Template:Malaysian election result/total (diff). |
The template {{Malaysian election result}} is intended to create tables showing the election or by-election results in one constituency. It can be used on the pages of the constituencies, of the candidates, or on template pages that are transcluded onto both. It works in conjunction with five other templates: {{Malaysian election result/top}}, {{Malaysian election result/total}}, {{Malaysian election result/gain}}, {{Malaysian election result/hold}}, and {{Malaysian election result/source}}.
/top template
[edit]Begin each table with {{MASelec/top}}.
The first thing that needs to be specified is whether this is a general election, or state election.
Use the country name (for example Malaysia
) or state name (for example Pahang
). A table is given at the bottom of this page.
General format
[edit]- Basic form
Use {{MASelec/top|jurisdiction|election}}
. The jurisdiction field should be the state name and the election field should be the year.
For example, {{MASelec/top|Kedah|2018}}
gives:
Party | Candidate | Votes |
---|
- With constituency name
Use {{MASelec/top|jurisdiction|election|constituency|constituency display}}
. The constituency display
field can be omitted when the constituency's article name does not contain disambiguation.
For example, {{MASelec/top|Malaysia|2018|Langkawi (federal constituency)|Langkawi}}
gives:
Party | Candidate | Votes |
---|
- With extra data columns
Extra columns can be added to provide additional dato. For example, {{MASelec/top|Malaysia|2018|Langkawi (federal constituency)|Langkawi|percent=yes|change=yes|expenditures=yes}}
gives:
Party | Candidate | Votes | % | ∆% | Expenditures |
---|
General parameters
[edit]- first unnamed parameter; or
jurisdiction=
- This is the full title of the country name (for example
Malaysia
) or state name (for examplePahang
).
- second unnamed parameter or
election=
- This is the four-digit year for a general election, or some other text (for example a full date) for a by-election.
- third unnamed parameter or
constituency=
- This is the full title of a Wikipedia article about a constituency. For example:
Pekan (federal constituency)
- (optional) fourth unnamed parameter or
constituency_display=
- This is the displayed text for the constituency name, if different from the above. For example:
Pekan
Optional parameters
[edit]- by=yes
- Use for by-elections. When using this, give the full date of the by-election rather than just the year.
- reason=
- Explain the reason for the by-election. For example,
reason=upon the resignation of Abdul Taib Mahmud
. - percent=yes
- Use this parameter to add a column with the heading "%".
- change=yes
- Use this parameter to add a column with the heading "∆%".
- expenditures=yes
- Use this parameter to add a column with the heading "Expenditures".
- elected=yes
- Use for multi-member constituencies that elect multiple members off of one ballot to add a column with the heading "Elected".
- 1st=yes|percent=yes|final=yes|percent2=yes
- Use these parameters to create columns for multi-round elections.
- ballot=A or ballot=B or ballot=C
- Use one of these parameters for multi-member constituencies that run multiple ballots each with a different slate of candidates during each election. It will only change the links in the heading.
- collapsed=
- The table is by default collapsible. You can set the initial collapsedness as follows:
yes
,auto
, orno
. These correspond to initial states of "collapsed", "autocollapse", or none, as documented at Help:Collapsing. For instance, if an article about a riding has a long list of election results from years past, you may want to have the first one display (for the most recent election) but keep the previous election years collapsed.
Main template
[edit]Use a copy of this template, {{Malaysian election result}}, for each row. The basic version of template is {{MASelec |jurisdiction |party |candidate |votes}}
. The jurisdiction must be the country name or state name for state elections. The party name must match the format of party names in the "input text" column of the master list of parties. The candidate name can be wikilinked if the article exists. The full version of this template is {{MASelec |jurisdiction |party |candidate |votes |4th column |5th column |6th column}}
. The last three fields are optional, and what should be put in them depends on what headers were used. For multi-member constituencies, use elected=yes
to add a checkmark in the "Elected" column.
/total template
[edit]Use a copy of this template, {{MASelec/total}}, for each total row (for example, Total valid votes, Total rejected ballots, Unreturned ballots, Turnout, Registered electors, Majority). The full version of this template is {{MASelec/total |heading |votes column |4th column |5th column |6th column}}
. The last three fields are optional.
See Malaysian election result/total documentation for instructions on how to find the data and complete the various total rows.
/gain and /hold templates
[edit]These templates can be used to identify gains and holds for the winning party, together with the swing calculated for the result compared to the previous election. The basic version of template is {{MASelec/gain | gaining party |losing party | swing}}
and {{MASelec/hold | party | swing}}
, with the party input in the same way as in {{MASelec}}. The /gain template may additionally add the party that the seat was taken from in the second parameter.
Swing calculated using the formula ((∆%₁− ∆%₂) ÷ 2 ) (i.e. Change in winner's percentage compared to previous year minus change in second place percentage divided by two)
For example, {{MASelec/gain |Malaysia |PKR |BN |+10.30}}
produces:
Malaysia gain from PKR | Swing | BN |
/source and /note templates
[edit]These templates can be used to add a row to the bottom of the table. For example: {{MASelec/source|All data comes from Election Commission of Malaysia.}}
. If the line of text contains an equals sign, as many government links do, name the field source=
.
Links to multiple source can be added in an expandable “Source(s)}” section by assigning all the links to the parameter hide=
(create separate lines by separating each source with <br />
).
For example: {{MASelec/source|hide={{cite web |title=Source 1 |url=http://www.spr.gov.my/source1 |publisher=[[Election Commission of Malaysia]] |accessdate=18 August 2024}}
in a table produces:
{{cite web |title=Source 2 |url=http://www.federalgazette.agc.gov.my/source2 |publisher= Attorney General's Chambers of Malaysia |accessdate=18 August 2024}} }}
Party | Candidate | Votes | % | ∆% | ||
---|---|---|---|---|---|---|
Source(s)
"Source 1". Election Commission of Malaysia. Retrieved 18 August 2024. "Source 2". Attorney General's Chambers of Malaysia. Retrieved 18 August 2024. |
end template
[edit]Finish election boxes with the {{end}} template.
Example
[edit]Here is an example using the federal constituency of Pandan in the 2018 federal election. The code:
{{MASelec/top|Malaysia|2018|Pandan (federal constituency)|Pandan|percent=yes|change=yes}}
{{MASelec||PH (2018)|[[Wan Azizah Wan Ismail]]|64,733|75.47|}}
{{MASelec||BN|Leong Kok Wee|12,190|14.21|}}
{{MASelec||PAS|Mohamed Sukri Omar|8,336|9.72|}}
{{MASelec||PRM|[[Lee Ying Ha]]|442|0.52|}}
{{MASelec||BEBAS|Mohd Khairul Azam Abdul Aziz|73|0.09|}}
{{MASelec/total|Total valid votes|85,774| 100.00}}
{{MASelec/total|Total rejected ballots|517|}}
{{MASelec/total|Unreturned ballots|223|}}
{{MASelec/total|Turnout|86,514|85.34}}
{{MASelec/total|Registered electors|101,379|}}
{{MASelec/total|Majority|52,543|61.26}}
{{MASelec/gain||PH (2018)|PKR|?}}
{{MASelec/source|hide={{cite web|url=http://www.federalgazette.agc.gov.my/outputp/pub_20180504_P.U.%20%28B%29%20239%20SELANGOR.pdf |title=His Majesty's Government Gazette - Notice of Contested Election, Parliament for the State of Selangor [P.U. (B) 239/2018]|date=3 May 2018|publisher=Attorney General's Chambers of Malaysia|accessdate=2018-08-01}}
{{cite web|url=http://www.federalgazette.agc.gov.my/outputp/pub_20180530_P.U.%20%28B%29%20313.pdf |title=Federal Government Gazette - Results of Contested Election and Statements of the Poll after the Official Addition of Votes, Parliamentary Constituencies for the State of Selangor [P.U. (B) 313/2018]|date=28 May 2018|publisher=Attorney General's Chambers of Malaysia|accessdate=2018-08-01}}}}
{{end}}
will produce:
Party | Candidate | Votes | % | ∆% | ||
---|---|---|---|---|---|---|
[[|parameter 1 should be a party name.]] | PH (2018) | Wan Azizah Wan Ismail | 64,733 | 75.47 | ||
[[|parameter 1 should be a party name.]] | BN | Leong Kok Wee | 12,190 | 14.21 | ||
[[|parameter 1 should be a party name.]] | PAS | Mohamed Sukri Omar | 8,336 | 9.72 | ||
[[|parameter 1 should be a party name.]] | PRM | Lee Ying Ha | 442 | 0.52 | ||
[[|parameter 1 should be a party name.]] | BEBAS | Mohd Khairul Azam Abdul Aziz | 73 | 0.09 | ||
Total valid votes | 85,774 | 100.00 | ||||
Total rejected ballots | 517 | |||||
Unreturned ballots | 223 | |||||
Turnout | 86,514 | 85.34 | ||||
Registered electors | 101,379 | |||||
Majority | 52,543 | 61.26 | ||||
[[|parameter 1 should be a party name.]] gain from [[|PH]] | Swing | PKR | ||||
Source(s) "His Majesty's Government Gazette - Notice of Contested Election, Parliament for the State of Selangor [P.U. (B) 239/2018]" (PDF). Attorney General's Chambers of Malaysia. 3 May 2018. Retrieved 2018-08-01. "Federal Government Gazette - Results of Contested Election and Statements of the Poll after the Official Addition of Votes, Parliamentary Constituencies for the State of Selangor [P.U. (B) 313/2018]" (PDF). Attorney General's Chambers of Malaysia. 28 May 2018. Retrieved 2018-08-01. |
TemplateData (main template)
[edit]This template produces one row in a table of Malaysian election results
Parameter | Description | Type | Status | |
---|---|---|---|---|
Jurisdiction | 1 | Use three-letter codes. Malaysia=MAS, Johor=JOH, etc. For cities, use three-letter codes.
| Line | required |
Party | 2 | Short-form name of the candidate's political party
| Line | required |
Candidate | 3 | Name of the candidate. Can be wikilinked.
| Line | optional |
Votes | 4 | Number of votes won by the candidate.
| Line | optional |
4th column | 5 | Adds text to the 4th column. Check the table's headings to see what information belongs in this column.
| Line | optional |
5th column | 6 | Adds text to the 5th column. Check the table's headings to see what information belongs in this column.
| Line | optional |
6th column | 7 | Adds text to the 6th column. Check the table's headings to see what information belongs in this column.
| Line | optional |
Elected | elected | Used for ridings that elect multiple candidates on one ballot. Write 'yes' to add a checkmark in the last column.
| Line | optional |
See also
[edit]![]() | This is the template sandbox page for Template:Malaysian election result/total (diff). |
Calculating Totals
[edit]Item | Source / Formula | |
---|---|---|
❶ | Candidates | List candidates in order used in official list (e.g. http://wemakevotingeasy.ca/en/electoral-districts/059-oak-ridges-markham.aspx) List election results in descending order of number of votes (i.e. Winner first) |
❷ | Votes | From Summary of valid ballots by candidate report elections.ca, elections.ab.ca, www.elections.gov.nl.ca, elections.on.ca |
❸ | % | ❷ ÷ ❼ × 100 rounded to 2 decimal places |
❹ | ∆% | current ❸ − previous ❸ Note: A ⃝ For ① & ②, if Party (or same Independent candidate) didn't run last time, use " "; if ❸ unchanged from previous, use "– " (– )A ⃝ — Occasionally column ❹ does not balance due to rounding errors. Check if: ( ∑❹ + numbers in ❸ where ❹ is blank (i.e. new candidates) − previous ❸ that didn't run this time ) ≠ 0 If there are rounding issues (i.e. above totals ±0.01/±0.02) then recalculate each ❹ without rounding errors using the formula: ( ( previous ❷ ÷ previous ❼ ) − ( current ❷ ÷ current ❼ ) ) × 100 then rounded to 2 decimals |
❺ | Expenditures | From Candidate Campaign Returns - CR-1, individual candidate Financial Statements, financial summary reports (by party/candidate) (or other similar late stage reports) – might be published a year after the election — Until expenditure figures are published, avoid including the blank column in tables. |
❻ | Totals caption | Add suffix "/Expense limit" if "|expenditures=yes " in CANelec/top (causing "Expenditures" column to be displayed)
|
❼ | Total Votes | ∑❷ = Balance in Statistical Summary |
❽ | Total % | ∑❸ = 100.0 – Note it's "{{nowrap|100.0 }} " not "100.00 " because .0 vs .00 solves occasional rounding issues & " " aligns decimals
|
❾ | Total ∆% | ( current ❼ − previous ❼ ) ÷ previous ❼ × 100 — +Increase /−Decrease in number of (valid) votes cast |
❿ | Expense limit | Identified in Campaign Returns / Financial Statements and/or separate reports/statements of expense & contribution limits |
⓫ | Rejected Votes | ∑number of rejected, unmarked, & cancelled ballots from Statistical Summary |
⓬ | Rejected % | ⓫ ÷ ⓮ × 100 |
⓭ | Rejected ∆% | current ⓬ − previous ⓬ |
⓮ | Votes Turnout | = ❼ + ⓫ — matches Statistical Summary |
⓯ | % Turnout | ⓮ ÷ ⓱ × 100 matches Statistical Summary but calculate to 2 decimals |
⓰ | ∆% Turnout | current ⓯ − previous ⓯ |
⓱ | Eligible Votes | from Statistical Summary — Total number of names Registered + Revision |
⓲ | Eligible % | Blank (" ")
|
⓳ | Eligible ∆% | ( current ⓱ − previous ⓱ ) ÷ previous ⓱ × 100 — +Increase /−Decrease in number of eligible voters |
⓴ | Prelim | This note should be included until official results are published/updated in table. Use the parameter " prelim=yes " in the /source or /note templates or in the /top template to add this preformatted message.
|