Template:Malaysian election result/doc
This is a documentation subpage for Template:Malaysian election result. It may contain usage information, categories and other content that is not part of the original template page. |
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=11 November 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=11 November 2024}} }}
Party | Candidate | Votes | % | ∆% | ||
---|---|---|---|---|---|---|
Source(s)
"Source 1". Election Commission of Malaysia. Retrieved 11 November 2024. "Source 2". Attorney General's Chambers of Malaysia. Retrieved 11 November 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 is a documentation subpage for Template:Malaysian election result. It may contain usage information, categories and other content that is not part of the original template page. |
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 |