Template:Canada elections/navigate previous/sandbox
This is the template sandbox page for Template:Canada elections/navigate previous (diff). |
{{Canada elections/federal election}}
, {{Canada elections/federal election year}}
, {{Canada elections/navigate previous}}
, and {{Canada elections/navigate next}}
are intended to be used in the Canadian federal election navigational boxes, (for example Template:Canadian federal election, 2011A,) however they may have other uses.
Usage
edit{{Canada elections/federal election}}
takes one parameter, a year between 1867 and 2019, and produces the election number{{Canada elections/federal election year}}
takes one parameter, a number between 1 and 43, and produces the year of the election{{Canada elections/navigate previous}}
takes one parameter, an election year, if present in the pagename, a link to that page on the previous election will be produced{{Canada elections/navigate next}}
takes one parameter, an election year, if present in the pagename, a link to that page on the following election will be produced
Examples
editElection numbers and years
edit- Year to number.
{{Canada elections/federal election|1958}}
produces 24
{{Canada elections/federal election|1962}}
produces 25
- Number to year.
{{Canada elections/federal election year|25}}
produces 1962
{{Canada elections/federal election year|26}}
produces 1963
- There and back.
{{#expr:{{Canada elections/federal election|1963}}+1}}
produces 27
{{Ordinal|{{#expr:{{Canada elections/federal election|1965}}+1}}}}
produces 28th
{{Canada elections/federal election year|{{#expr:{{Canada elections/federal election|1968}}+1}}}}
produces 1972
Invalid parameters
edit- Numbers out of range
{{Canada elections/federal election|1973}}
{{Canada elections/federal election|29}}
{{Canada elections/federal election year|029}}
{{Canada elections/federal election year|1974}}
- Text
{{Canada elections/federal election|Foo}}
{{Canada elections/federal election year|Foo}}
{{Canada elections/navigate previous|Foo}}
{{Canada elections/navigate next|Foo}}
Linking to articles ending in "Canadian federal election"
edit{{Canada elections/navigate previous|1979}}
produces [[Progressive Conservative Party of Canada candidates, 1974 Canadian federal election|←]]
{{Canada elections/navigate next|1979}}
produces [[Progressive Conservative Party of Canada candidates, 1980 Canadian federal election|→]]
{{Canada elections/navigate previous|1980}}
produces [[Liberal Party of Canada candidates, 1974 Canadian federal election|←]]
{{Canada elections/navigate next|1980}}
produces [[Liberal Party of Canada candidates, 1984 Canadian federal election|→]]
Linking to Parliaments
edit{{Canada elections/navigate previous|1993}}
produces [[34th Canadian Parliament|←]]
{{Canada elections/navigate next|1993}}
produces [[36th Canadian Parliament|→]]
{{Canada elections/navigate previous|1997}}
produces [[34th Canadian Parliament|←]]
{{Canada elections/navigate next|1997}}
produces [[36th Canadian Parliament|→]]
Linking to articles ending in the year
edit{{Canada elections/navigate previous|2000}}
produces [[Canadian federal election, 1997|←]]
{{Canada elections/navigate next|2000}}
produces [[Canadian federal election, 2004|→]]
{{Canada elections/navigate previous|2004}}
produces [[Results of the Canadian federal election, 2000|←]]
{{Canada elections/navigate next|2004}}
produces [[Results of the Canadian federal election, 2006|→]]
{{Canada elections/navigate previous|2006}}
produces [[Timeline of the Canadian federal election, 2004|←]]
{{Canada elections/navigate next|2006}}
produces [[Timeline of the Canadian federal election, 2008|→]]
Linking to pages outside the mainspace
edit{{Canada elections/navigate previous|2008}}
produces [[Template:Canadian federal election, 2006A|←]]
{{Canada elections/navigate next|2008}}
produces [[Template:Canadian federal election, 2011A|→]]
{{Canada elections/navigate previous|2011}}
produces [[Template:Canadian federal election, 2008|←]]
{{Canada elections/navigate next|2011}}
produces [[Template:Canadian federal election, 2015|→]]
{{Canada elections/navigate previous|2015}}
produces [[User:Example/Target ridings in 2011/NDP|←]]
{{Canada elections/navigate next|2015}}
produces [[User:Example/Target ridings in 2019/NDP|→]]
- Because off-mainspace is limited to 50 characters, User:Example/Target ridings in the Canadian federal election, 2015 will result in
{{Canada elections/navigate previous|2015}}
looking for the existence of 2011er:Example/Target ridings in the Canadian federal election, 2015.
Invalid combinations
edit- Years do not match.
{{Canada elections/navigate previous|1980}}
on Canadian federal election, 1979
{{Canada elections/navigate next|1979}}
on Canadian federal election, 1980
- Page does not exist.
{{Canada elections/navigate previous|2004}}
on Conservative Party of Canada candidates, 2004 Canadian federal election
{{Canada elections/navigate next|2000}}
on Progressive Conservative Party of Canada candidates, 2000 Canadian federal election
- No year in page name.
{{Canada elections/navigate previous|2004}}
on Paul Martin
{{Canada elections/navigate next|2006}}
on Stephen Harper
- Year out of range.
{{Canada elections/navigate previous|2009}}
on Canadian federal by-elections, 2009
{{Canada elections/navigate next|2014}}
on Canadian federal election, 2014