Template:Election box US auto/doc
![]() | This is a documentation subpage for Template:Election box US auto. It may contain usage information, categories and other content that is not part of the original template page. |
![]() | This template uses Lua: |
Usage
[edit]Basic
[edit]Example: {{election box US auto|California|2016|United States Representative District 7}}
Party | Candidate | Votes | % | |
---|---|---|---|---|
Democratic | Ami Bera (Incumbent) | 152,133 | 51.2% | |
Republican | Scott Jones | 145,168 | 48.8% | |
Total votes | 297,301 | 100.0% | ||
Democratic hold |
Primary
[edit]You can also include primary information in the same box. Example: {{election box US auto|California|2016|State Assembly Member District 65|primary=yes}}
Primary election | ||||||
---|---|---|---|---|---|---|
Party | Candidate | Votes | % | |||
Democratic | Sharon Quirk-Silva | 42,890 | 54.3% | |||
Republican | Young Kim (Incumbent) | 36,028 | 45.7% | |||
Total votes | 78,918 | 100.0% | ||||
General election | ||||||
Democratic | Sharon Quirk-Silva | 79,654 | 53.2% | |||
Republican | Young Kim (Incumbent) | 69,941 | 46.8% | |||
Total votes | 149,595 | 100.0% | ||||
Democratic gain from Republican |
References
Autolinking
[edit]The template automatically tries to create links to candidates if they have pages. If the candidate's exact name has an article, then it will further check if it is a redirect, and follow it if so. Some candidates have redirects to the articles about their election, so we won't follow redirects to articles with the word "elections" in them. If no article exists (or it was a redirect to the election page), then no link is created unless |redlinks=1
was passed.
Sometimes you want to manually control the link target, like in cases where there's a disambiguation page. You can do so by passing a parameter in the format of |<name> link=target
. For example, if the name in the dataset is Bernard "Bernie" Sanders
, you would use |Bernard "Bernie" Sanders link=Bernie Sanders
.
A {{election box}} template for US elections that automatically builds the table using tabular data from Commons.
Parameter | Description | Type | Status | |
---|---|---|---|---|
State | 1 | no description
| String | required |
Year | 2 | Year the election took place. Can also be a comma separated list of years for multiple boxes
| Number | required |
Contest | 3 | Name of the contest as specified in the tabular data
| String | required |
Type | type | Type of election, can be "Primary"
| String | optional |
Hold | hold | "held" if the same party held the seat, or "flip" if Democrats/Republicans switched.
| Unknown | optional |
Gain party | gain | Name of party which gains the seat
| String | optional |
Loser party | loser | Name of party that lost the seat
| String | optional |
Primary | primary | Whether to include primary information in the same template
| String | optional |
no headings | no headings | Whether to disable automatic headings when multiple boxes are being generated (comma separated list of years)
| String | optional |