Difference between revisions of "Template:Election table/doc"

From blackwiki
Jump to navigation Jump to search
imported>Trevor MacInnis
m ({{mergefrom|Election table|Template talk:Electiontable}})
imported>Hildeoc
m (removed excess newline)
 
(40 intermediate revisions by 28 users not shown)
Line 1: Line 1:
<includeonly>{{template doc page transcluded}}</includeonly><noinclude>{{template doc page viewed directly}}</noinclude>
+
<noinclude>{{Documentation subpage}}</noinclude>
 
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->
 
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->
{{mergefrom|Election table|Template talk:Electiontable}}
+
 
==Usage==
+
== Usage ==
 
This template marks the beginning of a table and defines borders, margins, background colours, and text alignment within the table. (Default alignment is "right", others must be specified.) Table rows and cells are written as usual, and the table is closed with "<code><nowiki>|}</nowiki></code>"
 
This template marks the beginning of a table and defines borders, margins, background colours, and text alignment within the table. (Default alignment is "right", others must be specified.) Table rows and cells are written as usual, and the table is closed with "<code><nowiki>|}</nowiki></code>"
  
 
For example, to have a table as shown below, include the code shown to the right:
 
For example, to have a table as shown below, include the code shown to the right:
{| align="right" style="margin:0 0 1em 2em;"
+
{| style="margin:0 0 1em 2em; float:right;"
|<small><pre>{{electiontable|Table template pagename}}
+
|<small><pre>{{electiontable|Table template pagename|Summary of [[Mars|Martian]] election results, 2020}}
'''Summary of [[Mars|Martian]] election results, [[2005]]'''
+
|-
|-style="background:#E9E9E9;"
+
! colspan="2" style="text-align:left;" | Parties
! align="left"|Parties
 
 
! Votes
 
! Votes
 
! %
 
! %
! +/-
+
! ±
 
! Seats
 
! Seats
! +/-
+
! ±
 +
|-
 +
| style="background-color:#ff0000;" |
 +
| style="text-align:left;" | The red party
 +
| 6042
 +
| 45.40
 +
| −4.41
 +
| 23
 +
| −2
 +
|-
 +
| style="background-color:#00ff00;" |
 +
| style="text-align:left;" | The green party
 +
| 5678
 +
| 42.67
 +
| +1.23
 +
| 21
 +
| 0
 
|-
 
|-
| align="left"|The Green Party
+
| style="background-color:#0000ff;" |
| 123,456
+
| style="text-align:left;" | Free Mars
| 79.2
+
| 345
| -8.3
+
| 2.59
| 53
+
| +2.59
| -8
+
| 1
 +
| +1
 
|-
 
|-
| align="left"|The Red Party
+
| style="background-color:#eeeeee;" |
| 23,697
+
| style="text-align:left;" | None of the above (unfilled seats)
| 15.2
+
| 1242
| +6.6
+
| 9.33
| 10
+
| +0.59
| +4
+
| 5
 +
| +1
 
|-
 
|-
| align="left"|The Sun-Followers' Party
+
! colspan="2" style="text-align:left;" | Total
| 8,730
+
! 13307
| 5.6
+
! style="text-align:center;" colspan="2"| 100%
| +1.7
+
! style="text-align:center;" colspan="2"| 50
| 4
 
| +4
 
|-style="background:#E9E9E9;"
 
! align="left"|Total
 
! 155,883
 
! align="center" colspan="2"|100%
 
! align="center" colspan="2"|67
 
 
|}</pre></small>
 
|}</pre></small>
 
|}
 
|}
  
{{electiontable|Table template pagename}}'''Summary of [[Mars|Martian]] election results, [[2005]]'''
+
{{electiontable|Table template pagename|Summary of [[Mars|Martian]] election results, 2020}}
|-style="background:#E9E9E9;"
+
|-
! align="left"|Parties
+
! colspan="2" style="text-align:left;" | Parties
 
! Votes
 
! Votes
 
! %
 
! %
! +/-
+
! ±
 
! Seats
 
! Seats
! +/-
+
! ±
 +
|-
 +
| style="background-color:#ff0000;" |
 +
| style="text-align:left;" | The red party
 +
| 6042
 +
| 45.40
 +
| −4.41
 +
| 23
 +
| −2
 +
|-
 +
| style="background-color:#00ff00;" |
 +
| style="text-align:left;" | The green party
 +
| 5678
 +
| 42.67
 +
| +1.23
 +
| 21
 +
| 0
 
|-
 
|-
| align="left"|The Green Party
+
| style="background-color:#0000ff;" |
| 123,456
+
| style="text-align:left;" | Free Mars
| 79.2
+
| 345
| -8.3
+
| 2.59
| 53
+
| +2.59
| -8
+
| 1
 +
| +1
 
|-
 
|-
| align="left"|The Red Party
+
| style="background-color:#eeeeee;" |
| 23,697
+
| style="text-align:left;" | None of the above (unfilled seats)
| 15.2
+
| 1242
| +6.6
+
| 9.33
| 10
+
| +0.59
| +4
+
| 5
 +
| +1
 
|-
 
|-
| align="left"|The Sun-Followers' Party
+
! colspan="2" style="text-align:left;" | Total
| 8,730
+
! 13307
| 5.6
+
! style="text-align:center;" colspan="2"| 100%
| +1.7
+
! style="text-align:center;" colspan="2"| 50
| 4
 
| +4
 
|-style="background:#E9E9E9;"
 
! align="left"|Total
 
! 155,883
 
! align="center" colspan="2"|100%
 
! align="center" colspan="2"|67
 
 
|}
 
|}
  
<includeonly>
+
== Options ==
[[Category:Election result formatting templates|{{PAGENAME}}]]
+
Instead of <code><nowiki>{{electiontable|template pagename}} Title</nowiki></code> you can use <code><nowiki>{{electiontable|template pagename|Title}}</nowiki></code>. The title will be bolded automatically.
 +
 
 +
To add <code><nowiki>class="sortable"</nowiki></code>, use <code><nowiki>...|sortable=yes}}</nowiki></code>. If you use this, you will need to edit your table to have <code><nowiki>|- class="sortbottom"</nowiki></code> as the row separator for the total row. If you want a specific column not to be sortable, specify <code><nowiki>class="unsortable"</nowiki></code> in the attributes of its header cell. Sorted tables do not currently work with tables using <code>colspan</code>. See [[meta:Help:Sorting|Help:Sorting]] for more information about sorting.
 +
 
 +
To align the table on the right side of the page, use <code><nowiki>...|align=right}}</nowiki></code>.
 +
 
 +
To suppress the editlink, use <code><nowiki>...|editlink=no}}</nowiki></code>.
 +
 
 +
For direct use in an article instead of a template, use <code><nowiki>...|editlink=no|2=</nowiki>''Title''</code>.
 +
 
 +
To collapse the table, use <code><nowiki>...|collapsed=yes</nowiki></code>
  
[[cs:šablona:volebnítabulka]]
+
<includeonly>{{Sandbox other||
[[uk:Шаблон:electiontable]]
+
[[Category:Election and referendum result templates]]
</includeonly>
+
[[Category:Table templates]]
 +
}}</includeonly>

Latest revision as of 03:04, 23 November 2020

Usage

This template marks the beginning of a table and defines borders, margins, background colours, and text alignment within the table. (Default alignment is "right", others must be specified.) Table rows and cells are written as usual, and the table is closed with "|}"

For example, to have a table as shown below, include the code shown to the right:

{{electiontable|Table template pagename|Summary of [[Mars|Martian]] election results, 2020}}
|-
! colspan="2" style="text-align:left;" | Parties
! Votes
! %
! ±
! Seats
! ±
|-
| style="background-color:#ff0000;" |
| style="text-align:left;" | The red party
| 6042
| 45.40
| −4.41
| 23
| −2
|-
| style="background-color:#00ff00;" |
| style="text-align:left;" | The green party
| 5678
| 42.67
| +1.23
| 21
| 0
|-
| style="background-color:#0000ff;" |
| style="text-align:left;" | Free Mars
| 345
| 2.59
| +2.59
| 1
| +1
|-
| style="background-color:#eeeeee;" |
| style="text-align:left;" | None of the above (unfilled seats)
| 1242
| 9.33
| +0.59
| 5
| +1
|-
! colspan="2" style="text-align:left;" | Total
! 13307
! style="text-align:center;" colspan="2"| 100%
! style="text-align:center;" colspan="2"| 50
|}
[{{fullurl:Template:Transclude|action=edit}} e] • [[|d]] Summary of Martian election results, 2020
Parties Votes % ± Seats ±
The red party 6042 45.40 −4.41 23 −2
The green party 5678 42.67 +1.23 21 0
Free Mars 345 2.59 +2.59 1 +1
None of the above (unfilled seats) 1242 9.33 +0.59 5 +1
Total 13307 100% 50

Options

Instead of {{electiontable|template pagename}} Title you can use {{electiontable|template pagename|Title}}. The title will be bolded automatically.

To add class="sortable", use ...|sortable=yes}}. If you use this, you will need to edit your table to have |- class="sortbottom" as the row separator for the total row. If you want a specific column not to be sortable, specify class="unsortable" in the attributes of its header cell. Sorted tables do not currently work with tables using colspan. See Help:Sorting for more information about sorting.

To align the table on the right side of the page, use ...|align=right}}.

To suppress the editlink, use ...|editlink=no}}.

For direct use in an article instead of a template, use ...|editlink=no|2=Title.

To collapse the table, use ...|collapsed=yes