Difference between revisions of "Template:Diagonal split header/doc"
imported>Pichnat Thong |
imported>Vanisaac m (→Template data: clean up per WP:CAT#T and WP:AWBREQ add template:Sandbox other) |
||
| (One intermediate revision by one other user not shown) | |||
| Line 54: | Line 54: | ||
| 4 || 9 || 2 | | 4 || 9 || 2 | ||
|} | |} | ||
| + | ==Template data== | ||
| + | |||
| + | <templatedata>{ | ||
| + | "description": "Simulate a table header cell split diagonally", | ||
| + | "params": { | ||
| + | "1": { | ||
| + | "label": "Rows", | ||
| + | "description": "header of row headers, shown on the bottom left", | ||
| + | "example": "''Y-axis''", | ||
| + | "type": "string", | ||
| + | "required": true | ||
| + | }, | ||
| + | "2": { | ||
| + | "label": "Columns", | ||
| + | "description": "header of column headers, shown on the top right", | ||
| + | "example": "{{color|#6cf|X-axis}}", | ||
| + | "type": "string", | ||
| + | "required": true | ||
| + | }, | ||
| + | "3": { | ||
| + | "label": "Background colour", | ||
| + | "description": "Optional colour of background, use <code>transparent</code> for standard non-header background", | ||
| + | "default": "#eaecf0", | ||
| + | "example": "transparent", | ||
| + | "type": "string", | ||
| + | "required": false | ||
| + | } | ||
| + | } | ||
| + | }</templatedata> | ||
| + | |||
| + | <includeonly>{{Sandbox other|| | ||
| + | <!-- Categories below this line, please; interwikis at Wikidata --> | ||
| + | [[Category:Table cell templates]] | ||
| + | }}</includeonly> | ||
Latest revision as of 23:40, 24 April 2020
| This is a documentation subpage for Template:Diagonal split header. It contains usage information, categories and other content that is not part of the original template page. |
Contents
Usage
This template simulates a table header cell split diagonally, a device often used to compactly label headers of rows and columns, as in this example:
To From |
Solid | Liquid | Gas |
|---|---|---|---|
| Solid | Solid-solid transformation | Melting | Sublimation |
| Liquid | Freezing | — | Boiling/evaporation |
| Gas | Deposition | Condensation | — |
To use it, create a header cell using ! followed by {{diagonal split header|NATURE-OF-ROW-HEADERS|NATURE-OF-COLUMN-HEADERS}}.
As the effect is achieved by drawing a diagonal line across the cell, the two headers are still part of the same cell and can easily overrun the line. A remedy is to pad the headers with non-breaking spaces ( ), line breaks Template:Nobr and/or CSS (escape = signs as {{=}}), as in the example above. The template user is responsible for checking that it does not overrun on common Web browsers.
Background colour and non-header cells
A third parameter can be added to change the background colour from the standard header cell colour. Changing it to transparent (or another colour such as white, or #ffffff) lets the template be applied to non-header cells. Prefix it with | instead of !, as in this Friend or Foe? payoff matrix:
Pair 2 Pair 1
|
"Friend" (cooperate) |
"Foe" (defect) |
|---|---|---|
| "Friend" (cooperate) |
1 1
|
2 0
|
| "Foe" (defect) |
0 2
|
0 0
|
Spanning columns and rows, and collapsible and sortable tables
The template is compatible with collapsible tables, and cells using colspan or rowspan, in which case place the colspan/rowspan attribute between ! and {{diagonal split header ...}}. It is not compatible with sortable tables, as the sort arrows are not drawn, but this problem can be resolved by using a second header row:
n City |
2025 | 2026 | ||
|---|---|---|---|---|
| Dec | Jan | Feb | ||
| Roma | Rome | 8 | 1 | 6 |
| Venezia | Venice | 3 | 5 | 7 |
| Firenze | Florence | 4 | 9 | 2 |
Template data
Simulate a table header cell split diagonally
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Rows | 1 | header of row headers, shown on the bottom left
| String | required |
| Columns | 2 | header of column headers, shown on the top right
| String | required |
| Background colour | 3 | Optional colour of background, use <code>transparent</code> for standard non-header background
| String | optional |