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

From blackwiki
Jump to navigation Jump to search
blackwiki>Andy M. Wang
({{high-use|6000+}})
m (63 revisions imported)
 
(13 intermediate revisions by 10 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
 
{{Lua|icononly=on |Module:Aligned table}}
 
{{Lua|icononly=on |Module:Aligned table}}
{{high-use|6000+}}
+
{{high-use|8130}}
 
<!----Please place categories where indicated at the bottom of this page and interwikis in Wikidata---->
 
<!----Please place categories where indicated at the bottom of this page and interwikis in Wikidata---->
The purpose is of this template is for generating simple tables in locations where [[Help:Table|standard table markup]] is either not possible, without significant use of the {{tld|!}} magic word (e.g., with a {{tl|sidebar}} template), or cumbersome (due to the repetitive use of specification of the same style statement in each row). This template should <u>not</u> be used to replace [[Help:Table|standard table markup]] in articles.  This template is meant to be complimentary to {{tl|infobox}} or {{tl|sidebar}}, and <u>not</u> a replacement for {{tl|infobox}} or {{tl|sidebar}}.
+
The purpose is of this template is for generating simple tables in locations where [[Help:Table|standard table markup]] is either not possible, without significant use of the {{tlc|!}} magic word (e.g., with a {{tl|sidebar}} template), or cumbersome (due to the repetitive use of specification of the same style statement in each row). This template should <u>not</u> be used to replace [[Help:Table|standard table markup]] in articles.  This template is meant to be complementary to {{tl|infobox}} or {{tl|sidebar}}, and <u>not</u> a replacement for {{tl|infobox}} or {{tl|sidebar}}.
  
 
A simpler method to include a table in a template that does not directly support table markup is to create the table in a sub-template using standard markup and transclude it.
 
A simpler method to include a table in a template that does not directly support table markup is to create the table in a sub-template using standard markup and transclude it.
Line 19: Line 19:
 
| colwidth =
 
| colwidth =
 
| leftright =
 
| leftright =
 +
| rightleft =
 
| colstyle =
 
| colstyle =
 
| rowstyle =
 
| rowstyle =
Line 44: Line 45:
  
 
== Parameters ==
 
== Parameters ==
 
+
<div style="overflow:auto;">
 
{{Aligned table
 
{{Aligned table
 
  |cols=4 |class=wikitable |style=line-height:1.35em;
 
  |cols=4 |class=wikitable |style=line-height:1.35em;
Line 64: Line 65:
  
 
  | fullwidth
 
  | fullwidth
  | {{nowrap|Set to anything ("on", "true", "yes", etc) to ensure table spans entire width available.}}<br />(Effect is to remove border-spacing and add width:100% to the table's styling.)
+
  | {{nowrap|If set (to anything, "on", "true", "yes", etc.), ensures table spans entire width available.}}
 +
 
 +
(Effect is to remove border-spacing and add width:100% to the table's styling.)
 
  | <code><nowiki> |fullwidth=on </nowiki></code>
 
  | <code><nowiki> |fullwidth=on </nowiki></code>
  | ''not set''
+
  | ''Not set''
  
 
  | class
 
  | class
 
  | CSS/[[HTML attribute|HTML class]]/es applied to the table.
 
  | CSS/[[HTML attribute|HTML class]]/es applied to the table.
 
  | <code><nowiki> |class=wikitable &nbsp; |class=infobox</nowiki><br /><nowiki>|class=sortable nowrap &nbsp; |class=sidebar</nowiki></code>
 
  | <code><nowiki> |class=wikitable &nbsp; |class=infobox</nowiki><br /><nowiki>|class=sortable nowrap &nbsp; |class=sidebar</nowiki></code>
  | ''none''
+
  | ''Not set''
  
 
  | style
 
  | style
 
  | [[CSS styling]] applied to the table.
 
  | [[CSS styling]] applied to the table.
 
  | <code>{{nowrap|<nowiki> |style=width:80%;background:transparent; </nowiki>}}</code>
 
  | <code>{{nowrap|<nowiki> |style=width:80%;background:transparent; </nowiki>}}</code>
  | ''none''
+
  | ''Not set''
  
 
  | colwidth
 
  | colwidth
 
  | Width of each column (or include "width:...;" in <kbd>colstyle</kbd>).
 
  | Width of each column (or include "width:...;" in <kbd>colstyle</kbd>).
 
  | <code><nowiki> |colwidth=6.0em &nbsp; |colwidth=25%</nowiki></code>
 
  | <code><nowiki> |colwidth=6.0em &nbsp; |colwidth=25%</nowiki></code>
  | ''not set''
+
  | ''Not set''
  
 
  | colstyle
 
  | colstyle
  | CSS styling applied to each column.
+
  | CSS styling prepended to the cell style for each column.
 
  | <code><nowiki> |colstyle=background:transparent; </nowiki></code>
 
  | <code><nowiki> |colstyle=background:transparent; </nowiki></code>
  | "
+
  | ''Not set''
  
 
  | rowstyle
 
  | rowstyle
Line 95: Line 98:
 
  <!-------Columns-------->
 
  <!-------Columns-------->
 
  | leftright
 
  | leftright
  | Set to anything ("on", "true", "yes", etc) in place of <kbd><nowiki>|col1align=left</nowiki></kbd> and <kbd><nowiki>|col2align=right</nowiki></kbd>
+
  | If set (to anything, "on", "true", "yes", etc.) is equivalent to <kbd><nowiki>|col1align=left</nowiki></kbd> and <kbd><nowiki>|col2align=right</nowiki></kbd>
 
  | <code><nowiki> |leftright=on </nowiki></code>
 
  | <code><nowiki> |leftright=on </nowiki></code>
  | ''not set''
+
  | ''Not set''
 +
 
 +
| rightleft
 +
| If set (to anything, "on", "true", "yes", etc.) is equivalent to <kbd><nowiki>|col1align=right</nowiki></kbd> and <kbd><nowiki>|col2align=left</nowiki></kbd>
 +
| <code><nowiki> |rightleft=on </nowiki></code>
 +
| ''Not set''
  
 
  | col{{var|C}}width
 
  | col{{var|C}}width
  | Width of column number {{var|C}} (or include "width:...;" in <kbd>col{{var|C}}style</kbd>).
+
  | CSS width property of cell in column {{var|C}} (or include "width:...;" in <kbd>col{{var|C}}style</kbd>).
 
  | <code><nowiki> |col2width=9.0em &nbsp; |col3width=35%</nowiki></code>
 
  | <code><nowiki> |col2width=9.0em &nbsp; |col3width=35%</nowiki></code>
  | ''none set''
+
  | ''Not set''
  
 
  | col{{var|C}}class
 
  | col{{var|C}}class
  | Class/es applied to column number {{var|C}}.
+
  | Classes added to cell in column {{var|C}}.
 
  | <code><nowiki> |col1class=navbox-group </nowiki></code>
 
  | <code><nowiki> |col1class=navbox-group </nowiki></code>
  | "
+
  | '' Not set''
  
 
  | col{{var|C}}align
 
  | col{{var|C}}align
  | Alignment (left{{\}}right{{\}}center) for column {{var|C}}'s cell contents (or include "text-align:...;" in <kbd>col{{var|C}}style</kbd>).
+
  | CSS text-align property (left{{\}}right{{\}}center) of cell in column {{var|C}}'s cell contents (or include "text-align:...;" in <kbd>col{{var|C}}style</kbd>).
 
  | <code><nowiki> |col4align=right </nowiki></code>
 
  | <code><nowiki> |col4align=right </nowiki></code>
  | ''none set''
+
  | ''Not set''
  
 
  | col{{var|C}}nowrap
 
  | col{{var|C}}nowrap
  | Set to anything ("on", "true", "yes", etc) to add "white-space:nowrap;" to column {{var|C}}'s cell styling (i.e. to prevent lines within its cells from wrapping; or include "nowrap" in <kbd>col{{var|C}}class</kbd> or "white-space:nowrap;" in <kbd>col{{var|C}}style</kbd>).
+
  | If set (to anything, "on", "true", "yes", etc.) adds "white-space:nowrap;" to the CSS style of cell in column {{var|C}} (i.e., to prevent lines within its cells from wrapping; or include "nowrap" in <kbd>col{{var|C}}class</kbd> or "white-space:nowrap;" in <kbd>col{{var|C}}style</kbd>).
 
  | <code><nowiki> |col5nowrap=on </nowiki></code>
 
  | <code><nowiki> |col5nowrap=on </nowiki></code>
  | "
+
  |  
  
 
  | col{{var|C}}style
 
  | col{{var|C}}style
  | CSS styling applied to column number {{var|C}}.
+
  | CSS style appended to cell in column {{var|C}}.
 
  | <code><nowiki> |col4style=font-style:italic; </nowiki></code>
 
  | <code><nowiki> |col4style=font-style:italic; </nowiki></code>
  | "
+
  | ''Not set''
  
  
 
  | col{{var|C}}header
 
  | col{{var|C}}header
  | Set to any value (e.g. <code>Y</code>) to change col's cells from data cells to table headers (headings).
+
  | If set (to any value), changes cells in column {{var|C}} to table headers (headings).
 
  | <code><nowiki> |col1header=on </nowiki></code>
 
  | <code><nowiki> |col1header=on </nowiki></code>
  | ''not set''
+
  | ''Not set''
  
 
  <!--------Rows---------->
 
  <!--------Rows---------->
 
  | row{{var|R}}class
 
  | row{{var|R}}class
  | Class/es applied to row number {{var|R}}.
+
  | Classes applied to row {{var|R}}.
 
  | <code><nowiki> |row10class=navbox-abovebelow </nowiki></code>
 
  | <code><nowiki> |row10class=navbox-abovebelow </nowiki></code>
  | ''none set''
+
  | ''Not set''
  
 
  | row{{var|R}}style
 
  | row{{var|R}}style
  | CSS styling applied to row number {{var|R}}.
+
  | CSS styling applied to row {{var|R}}.
 
  | <code><nowiki> |row2style=font-weight:bold; </nowiki></code>
 
  | <code><nowiki> |row2style=font-weight:bold; </nowiki></code>
  | "
+
  |
  
 
  | row{{var|R}}header
 
  | row{{var|R}}header
  | Set to any value (e.g. <code>Y</code>) to change row's cells from data cells to table headers (headings).
+
  | If set (to any value), changes cells in row {{var|R}} to table headers (headings).
 
  | <code><nowiki> |row1header=on </nowiki></code>
 
  | <code><nowiki> |row1header=on </nowiki></code>
  | ''not set''
+
  | ''Not set''
  
 
  <!--------Cells--------->
 
  <!--------Cells--------->
 
  | class{{var|R}}.{{var|C}}
 
  | class{{var|R}}.{{var|C}}
  | Class/es applied to cell in row {{var|R}}, column {{var|C}}. Overrides any other class attributions (<kbd>row{{var|R}}class</kbd>, <kbd>col{{var|C}}class</kbd>).
+
  | Classes applied to cell in row {{var|R}}, column {{var|C}}. Overrides any other class attributions (<kbd>row{{var|R}}class</kbd>, <kbd>col{{var|C}}class</kbd>).
 
  | <code><nowiki> |class1.2=adr </nowiki></code>
 
  | <code><nowiki> |class1.2=adr </nowiki></code>
  | ''none set''
+
  | ''Not set''
  
 
  | style{{var|R}}.{{var|C}}
 
  | style{{var|R}}.{{var|C}}
 
  | CSS styling applied to cell in row {{var|R}}, column {{var|C}}. Overrides any more general styling (<kbd>leftright</kbd>, <kbd>col{{var|C}}align</kbd>, <kbd>row{{var|R}}style</kbd>, etc).
 
  | CSS styling applied to cell in row {{var|R}}, column {{var|C}}. Overrides any more general styling (<kbd>leftright</kbd>, <kbd>col{{var|C}}align</kbd>, <kbd>row{{var|R}}style</kbd>, etc).
 
  | <code><nowiki> |style5.3=text-align:right; </nowiki></code>
 
  | <code><nowiki> |style5.3=text-align:right; </nowiki></code>
  | "
+
  | ''Not set''
  
 
  | {{sans-serif|''Unnamed parameters''}}
 
  | {{sans-serif|''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.
 
  | 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.
 
  | <code>{{!}} Azerbaijan {{!}} Malta {{!}} Zaire</code>
 
  | <code>{{!}} Azerbaijan {{!}} Malta {{!}} Zaire</code>
  | empty
+
  | ''Not set''
}}
+
}}</div>
  
 
== Examples ==
 
== Examples ==
Line 227: Line 235:
 
}}
 
}}
  
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox |
+
<pre>
| <!-- Categories below this line, please; interwikis to Wikidata. -->
+
{{Aligned table
 +
|cols=3 |class=wikitable sortable
 +
|row1header=y
 +
| U | # | l
 +
| A | 1 | a
 +
| B | 2 | b
 +
|  |  | 
 +
| C | 3 | c
 +
}}
 +
</pre>
 +
{{Aligned table
 +
|cols=3 |class=wikitable sortable
 +
|row1header=y
 +
| U | # | l
 +
| A | 1 | a
 +
| B | 2 | b
 +
|   |
 +
| C | 3 | c
 +
}}
 +
<includeonly>{{Sandbox other||
 
[[Category:Table templates]]
 
[[Category:Table templates]]
 
}}</includeonly>
 
}}</includeonly>

Latest revision as of 11:04, 20 October 2020

The purpose is of this template is for generating simple tables in locations where standard table markup is either not possible, without significant use of the {{!}} magic word (e.g., with a {{sidebar}} template), or cumbersome (due to the repetitive use of specification of the same style statement in each row). This template should not be used to replace standard table markup in articles. This template is meant to be complementary to {{infobox}} or {{sidebar}}, and not a replacement for {{infobox}} or {{sidebar}}.

A simpler method to include a table in a template that does not directly support table markup is to create the table in a sub-template using standard markup and transclude it.

Full syntax

For parameter explanations, see table below.

{{Aligned table
| cols =
| fullwidth =
| class =
| style =
| colwidth =
| leftright =
| rightleft =
| colstyle =
| rowstyle =

<!--for Cth column:-->
| colCwidth =
| colCclass =
| colCalign =
| colCstyle =
| colCnowrap =

<!--for Rth row:-->
| rowRclass =
| rowRstyle =
| rowRheader =

<!--for cell R,C:-->
| classR.C =
| styleR.C =

| (cell 1,1) | (cell 1,2) | ... | ...
| (cell 2,1) | (cell 2,2) | ... | ...
}}

Parameters

Script error: No such module "aligned table".

Examples

{{Aligned table
|cols=3 |class=wikitable
| A | 1 | a
| B | 2 | b
}}

Script error: No such module "aligned table".

{{Aligned table
|cols=4 |class=wikitable
|col1align=center |col2align=center
|col3align=right  |col4align=right
| AAA | aa    | 123  | 12345
| B   | bbbbb | 1234 | 2
}}

Script error: No such module "aligned table".

{{Aligned table
|class=wikitable |style=width:20em;
|col1align=center |col2align=right
| AAA | 123
| B   | 2
}}

Script error: No such module "aligned table".

{{Aligned table
|cols=3 |class=wikitable sortable
|row1header=y
| U | # | l
| A | 1 | a
| B | 2 | b
}}

Script error: No such module "aligned table".

{{Aligned table
|cols=3 |class=wikitable sortable
|row1header=y
| U | # | l
| A | 1 | a
| B | 2 | b
|   |   |  
| C | 3 | c
}}

Script error: No such module "aligned table".