Template:Aligned table
Appearance
This template uses Lua: |
Known limitations
[edit]- It is not currently recommended to combine use of this template with conventional table syntax due to differing approaches.
- It is not possible to use a custom header line which contains rowspan elements.
- When used in a multi-page transclusion (see usage notes below) , no indvidual page numbers will be displayed next to the relevant table portions,
(owing to interaction limitations with Proofread Page and LST).
Full syntax
[edit]For parameter explanations, see table below.
{{Aligned table | cols = | fullwidth = | class = | style = | colwidth = | leftright = | colstyle = | colalign = | rowstyle = | title = | titlestyle = | above = | abovestyle = | nobody = | nofooter = | noheader = <!--for Cth column:--> | colCwidth = | colwidthC = | colCclass = | colclassC = | classC = | colCalign = | alignC = | colCstyle = | colstyleC = | styleC = | colCnowrap = | colnowrapC = | nowrapC = | colCheader = <!--for Rth row:--> | rowRclass = | rowclassR = | rowRstyle = | rowstyleR = | rowRheader = | aboveR = | aboveRnormal = | aboveRclass = | aboveRstyle = <!--for cell R,C:--> | classR.C = | styleR.C = | (cell 1,1) | (cell 1,2) | ... | ... | (cell 2,1) | (cell 2,2) | ... | ... }}
Usage over multiple Page:
[edit]First Page (content) :
{{Aligned table | nofooter=yes <!-- required if data extends over more than one page. --> | row1header=yes <!-- to mark first row as the headers. --> | (cell 1,1) | (cell 1,2) | ... | ... | (cell 2,1) | (cell 2,2) | ... | ... }}
First Page (footer) :
{{Aligned table|noheader=yes|nobody=yes}}
Continuing pages (header):
{{Aligned table | nofooter=yes <!-- required if data extends over more than one page.--> | row1header=yes <!-- to mark first row as the headers. --> | (header call 1,1) | (header cell 1,2)|... |... }}
Continuing pages (body):
{{Aligned table | noheader=yes; nofooter=yes <!-- required if data extends over more than one page.--> ... | (data cell x,1) | (data cell x,2)|... |... | (data cell x+1,1) | (data cell x+1,2)|... |... }}
Continuing pages (footer) as for first page. Last page header as for continuing pages.
Last page body.
{{Aligned table | noheader=yes; <!-- required if data extends over more than one page. nofooter line is absent --> ... | (data cell x,1) | (data cell x,2)|... |... | (data cell x+1,1) | (data cell x+1,2)|... |... }} {{nop}}<!-- Optional but needed in some instances to create an appropriate break.-->
Parameters
[edit]Parameter | Description | Examples | Default |
---|---|---|---|
cols | Number of columns in the table. | |cols=4
| 2 |
fullwidth | Set to anything ("on", "true", "yes", etc) to ensure table spans entire width available. (Effect is to remove border-spacing and add width:100% to the table's styling.) | |fullwidth=on
| not set |
class | CSS/HTML class/es applied to the table. | |class=wikitable |class=infobox
| none |
style | CSS styling applied to the table. | |style=width:80%;background:transparent;
| none |
colwidth | Width of each column (or include "width:...;" in colstyle). | |colwidth=6.0em |colwidth=25%
| not set (only applied if no relevant colCwidth or colwidthC present) |
colstyle | CSS styling applied to each column. | |colstyle=background:transparent;
| none |
colalign | Alignment (left/right/center/justify) applied as "text-align:" prepended to all column stylings. | |colalign=justify
| none set |
rowstyle | CSS styling applied to each row (includes "aboveR" rows.) | |rowstyle=text-align:center;
| none |
title | text to be applied as overall table caption. | |title=Summary of Data
| not caption |
titlestyle | CSS styling applied to table caption. | |titlestyle=font-style:italic;font-variant:small-caps;
| empty |
above | text to be applied as full span (covers all columns) table header. | |above=Precis discussing the following…
| no spanning header |
abovestyle | CSS styling applied to spanning header cell. | |avovestyle=background:color:grey
| empty |
leftright | Set to anything ("on", "true", "yes", etc) in place of |col1align=left and |col2align=right | |leftright=on
| not set |
colCwidth | Width of column number C (or include "width:...;" in colCstyle). | |col2width=9.0em |col3width=35%
| none set |
colwidthC | Width of column number C (or include "width:...;" in colCstyle). | |colwidth4=5em |colwidth5=50%
| none set |
colCclass | Class/es applied to column number C. | |col1class=navbox-group
| " |
colclassC | Class/es applied to column number C. | |colclass3=prose
| " |
classC | Class/es applied to column number C. | |class4=redalert
| " |
colCalign | Alignment (left\right\center) for column C's cell contents (or include "text-align:...;" in colCstyle). | |col4align=right
| none set |
alignC | Alignment (left\right\center) for column C's cell contents (or include "text-align:...;" in colCstyle). | |align4=right
| none set |
colCnowrap | Set to anything ("on", "true", "yes", etc) to add "white-space:nowrap;" to column C's cell styling (i.e. to prevent lines within its cells from wrapping; or include "nowrap" in colCclass or "white-space:nowrap;" in colCstyle). | |col5nowrap=on
| " |
colnowrapC | Set to anything ("on", "true", "yes", etc) to add "white-space:nowrap;" to column C's cell styling (i.e. to prevent lines within its cells from wrapping; or include "nowrap" in colCclass or "white-space:nowrap;" in colCstyle). | |colnowrap2=on
| " |
nowrapC | Set to anything ("on", "true", "yes", etc) to add "white-space:nowrap;" to column C's cell styling (i.e. to prevent lines within its cells from wrapping; or include "nowrap" in colCclass or "white-space:nowrap;" in colCstyle). | |nowrap6=on
| " |
colCstyle | CSS styling applied to column number C. | |col4style=font-style:italic;
| " |
colstyleC | CSS styling applied to column number C. | |colstyle3=font-weight:bold;
| " |
styleC | CSS styling applied to column number C. | |colstyle2=background-color:gold;
| " |
colCheader | Set to any value (e.g. Y ) to change col's cells from data cells to table headers (headings).
| |col1header=on
| not set |
rowRclass | Class/es applied to row number R. | |row10class=navbox-abovebelow
| none set |
rowclassR | Class/es applied to row number R. | |rowclass3=references-small
| none set |
rowRstyle | CSS styling applied to row number R. | |row2style=font-weight:bold;
| " |
rowstyleR | CSS styling applied to row number R. | |rowstyle6=color:green;
| " |
rowRheader | Set to any value (e.g. Y ) to change row's cells from data cells to table headers (headings).
| |row1header=on
| not set |
aboveR | text to be applied as full span (covers all columns) entry above nominated row. | |above5=Section II: A New Start
| empty/no spanning entry |
aboveRnormal | Unset indicates spanning entry will be inserted as a table header cell with all that implies (centred; bold etc.) If set to anything ("on", "true", "yes", etc) spanning entry will be instead inserted as a standard table cell and only explicitly specified CSS classes or styling will be applied. | |above5normal=yes
| empty |
aboveRclass | Class/es to be applied to spanning entry above row number R. | |above5class=quote
| empty |
aboveRclass | CSS styling to be applied to spanning entry above row number R. | |above5style=text-align:center
| empty |
classR.C | Class/es applied to cell in row R, column C. Overrides any other class attributions (rowRclass, colCclass). | |class1.2=adr
| none set |
styleR.C | CSS styling applied to cell in row R, column C. Overrides any more general styling (leftright, colCalign, rowRstyle, etc). | |style5.3=text-align:right;
| " |
noheader | Used to suppress generation of table header in page namespace | | noheader=yes
| <table> is included
|
nofooter | Used to suppress generation of a table footer in page namespace | | nofooter=yes
| </table> is included
|
nobody | Used to suppress generation of a table contents | | nobody=yes
| Only <table></table> is emitted. This can be used when spanning tables over multiple pages. ( see below)
|
Unnamed parameters | Each unnamed parameter is taken to be the next cell in the table, starting at the table's top left corner and working left to right from top to bottom. | | Azerbaijan | Malta | Zaire
| empty |
Examples
[edit]{{Aligned table |cols=3 |class=wikitable | A | 1 | a | B | 2 | b }}
A | 1 | a |
B | 2 | b |
{{Aligned table |cols=4 |class=wikitable |col1align=center |col2align=center |col3align=right |col4align=right | AAA | aa | 123 | 12345 | B | bbbbb | 1234 | 2 }}
AAA | aa | 123 | 12345 |
B | bbbbb | 1234 | 2 |
{{Aligned table |class=wikitable |style=width:20em; |col1align=center |col2align=right | AAA | 123 | B | 2 }}
AAA | 123 |
B | 2 |
{{Aligned table |cols=3 |class=wikitable sortable |row1header=y | U | # | l | A | 1 | a | B | 2 | b }}
U | # | l |
---|---|---|
A | 1 | a |
B | 2 | b |
See also
[edit]- Module:Aligned table, the Lua module that generates this template.