Difference between revisions of "Template:Alternating rows table section/sandbox"
m (9 revisions imported) |
|||
| (2 intermediate revisions by one other user not shown) | |||
| Line 89: | Line 89: | ||
{{!}}- style="{{#ifexpr: ({{ #ifeq: {{{1}}} || 0 | 1 }} + {{ #ifeq: {{{2}}} || 0 | 1 }} + {{ #ifeq: {{{3}}} || 0 | 1 }} + {{ #ifeq: {{{4}}} || 0 | 1 }} + {{ #ifeq: {{{5}}} || 0 | 1 }} + {{ #ifeq: {{{6}}} || 0 | 1 }} + {{ #ifeq: {{{7}}} || 0 | 1 }} + {{ #ifeq: {{{8}}} || 0 | 1 }} + {{ #ifeq: {{{9}}} || 0 | 1 }} + {{ #ifeq: {{{10}}} || 0 | 1 }} + {{ #ifeq: {{{11}}} || 0 | 1 }} + {{ #ifeq: {{{12}}} || 0 | 1 }} + {{ #ifeq: {{{13}}} || 0 | 1 }} + {{ #ifeq: {{{14}}} || 0 | 1 }} + {{ #ifeq: {{{15}}} || 0 | 1 }} + {{ #ifeq: {{{16}}} || 0 | 1 }} + {{ #ifeq: {{{17}}} || 0 | 1 }} + {{ #ifeq: {{{18}}} || 0 | 1 }} + {{ #ifeq: {{{19}}} || 0 | 1 }} + {{ #ifeq: {{{20}}} || 0 | 1 }} + {{ #ifeq: {{{21}}} || 0 | 1 }} + {{ #ifeq: {{{22}}} || 0 | 1 }} + {{ #ifeq: {{{23}}} || 0 | 1 }} + {{ #ifeq: {{{24}}} || 0 | 1 }} + {{ #ifeq: {{{25}}} || 0 | 1 }} + {{ #ifeq: {{{26}}} || 0 | 1 }} + {{ #ifeq: {{{27}}} || 0 | 1 }} + {{ #ifeq: {{{28}}} || 0 | 1 }} + {{ #ifeq: {{{29}}} || 0 | 1 }}) mod 2 = 0 | {{{os|}}} | {{{es|}}} }}" | {{!}}- style="{{#ifexpr: ({{ #ifeq: {{{1}}} || 0 | 1 }} + {{ #ifeq: {{{2}}} || 0 | 1 }} + {{ #ifeq: {{{3}}} || 0 | 1 }} + {{ #ifeq: {{{4}}} || 0 | 1 }} + {{ #ifeq: {{{5}}} || 0 | 1 }} + {{ #ifeq: {{{6}}} || 0 | 1 }} + {{ #ifeq: {{{7}}} || 0 | 1 }} + {{ #ifeq: {{{8}}} || 0 | 1 }} + {{ #ifeq: {{{9}}} || 0 | 1 }} + {{ #ifeq: {{{10}}} || 0 | 1 }} + {{ #ifeq: {{{11}}} || 0 | 1 }} + {{ #ifeq: {{{12}}} || 0 | 1 }} + {{ #ifeq: {{{13}}} || 0 | 1 }} + {{ #ifeq: {{{14}}} || 0 | 1 }} + {{ #ifeq: {{{15}}} || 0 | 1 }} + {{ #ifeq: {{{16}}} || 0 | 1 }} + {{ #ifeq: {{{17}}} || 0 | 1 }} + {{ #ifeq: {{{18}}} || 0 | 1 }} + {{ #ifeq: {{{19}}} || 0 | 1 }} + {{ #ifeq: {{{20}}} || 0 | 1 }} + {{ #ifeq: {{{21}}} || 0 | 1 }} + {{ #ifeq: {{{22}}} || 0 | 1 }} + {{ #ifeq: {{{23}}} || 0 | 1 }} + {{ #ifeq: {{{24}}} || 0 | 1 }} + {{ #ifeq: {{{25}}} || 0 | 1 }} + {{ #ifeq: {{{26}}} || 0 | 1 }} + {{ #ifeq: {{{27}}} || 0 | 1 }} + {{ #ifeq: {{{28}}} || 0 | 1 }} + {{ #ifeq: {{{29}}} || 0 | 1 }}) mod 2 = 0 | {{{os|}}} | {{{es|}}} }}" | ||
{{{30|}}} }} {{{{#if:{{{30|}}}|1x|void}}| | {{{30|}}} }} {{{{#if:{{{30|}}}|1x|void}}| | ||
| + | }}{{#if:{{{31|}}}| | ||
| + | {{!}}- style="{{#ifexpr: ({{ #ifeq: {{{1}}} || 0 | 1 }} + {{ #ifeq: {{{2}}} || 0 | 1 }} + {{ #ifeq: {{{3}}} || 0 | 1 }} + {{ #ifeq: {{{4}}} || 0 | 1 }} + {{ #ifeq: {{{5}}} || 0 | 1 }} + {{ #ifeq: {{{6}}} || 0 | 1 }} + {{ #ifeq: {{{7}}} || 0 | 1 }} + {{ #ifeq: {{{8}}} || 0 | 1 }} + {{ #ifeq: {{{9}}} || 0 | 1 }} + {{ #ifeq: {{{10}}} || 0 | 1 }} + {{ #ifeq: {{{11}}} || 0 | 1 }} + {{ #ifeq: {{{12}}} || 0 | 1 }} + {{ #ifeq: {{{13}}} || 0 | 1 }} + {{ #ifeq: {{{14}}} || 0 | 1 }} + {{ #ifeq: {{{15}}} || 0 | 1 }} + {{ #ifeq: {{{16}}} || 0 | 1 }} + {{ #ifeq: {{{17}}} || 0 | 1 }} + {{ #ifeq: {{{18}}} || 0 | 1 }} + {{ #ifeq: {{{19}}} || 0 | 1 }} + {{ #ifeq: {{{20}}} || 0 | 1 }} + {{ #ifeq: {{{21}}} || 0 | 1 }} + {{ #ifeq: {{{22}}} || 0 | 1 }} + {{ #ifeq: {{{23}}} || 0 | 1 }} + {{ #ifeq: {{{24}}} || 0 | 1 }} + {{ #ifeq: {{{25}}} || 0 | 1 }} + {{ #ifeq: {{{26}}} || 0 | 1 }} + {{ #ifeq: {{{27}}} || 0 | 1 }} + {{ #ifeq: {{{28}}} || 0 | 1 }} + {{ #ifeq: {{{29}}} || 0 | 1 }} + {{ #ifeq: {{{30}}} || 0 | 1 }}) mod 2 = 0 | {{{os|}}} | {{{es|}}} }}" | ||
| + | {{{31|}}} }} {{{{#if:{{{31|}}}|1x|void}}| | ||
| + | }}{{#if:{{{32|}}}| | ||
| + | {{!}}- style="{{#ifexpr: ({{ #ifeq: {{{1}}} || 0 | 1 }} + {{ #ifeq: {{{2}}} || 0 | 1 }} + {{ #ifeq: {{{3}}} || 0 | 1 }} + {{ #ifeq: {{{4}}} || 0 | 1 }} + {{ #ifeq: {{{5}}} || 0 | 1 }} + {{ #ifeq: {{{6}}} || 0 | 1 }} + {{ #ifeq: {{{7}}} || 0 | 1 }} + {{ #ifeq: {{{8}}} || 0 | 1 }} + {{ #ifeq: {{{9}}} || 0 | 1 }} + {{ #ifeq: {{{10}}} || 0 | 1 }} + {{ #ifeq: {{{11}}} || 0 | 1 }} + {{ #ifeq: {{{12}}} || 0 | 1 }} + {{ #ifeq: {{{13}}} || 0 | 1 }} + {{ #ifeq: {{{14}}} || 0 | 1 }} + {{ #ifeq: {{{15}}} || 0 | 1 }} + {{ #ifeq: {{{16}}} || 0 | 1 }} + {{ #ifeq: {{{17}}} || 0 | 1 }} + {{ #ifeq: {{{18}}} || 0 | 1 }} + {{ #ifeq: {{{19}}} || 0 | 1 }} + {{ #ifeq: {{{20}}} || 0 | 1 }} + {{ #ifeq: {{{21}}} || 0 | 1 }} + {{ #ifeq: {{{22}}} || 0 | 1 }} + {{ #ifeq: {{{23}}} || 0 | 1 }} + {{ #ifeq: {{{24}}} || 0 | 1 }} + {{ #ifeq: {{{25}}} || 0 | 1 }} + {{ #ifeq: {{{26}}} || 0 | 1 }} + {{ #ifeq: {{{27}}} || 0 | 1 }} + {{ #ifeq: {{{28}}} || 0 | 1 }} + {{ #ifeq: {{{29}}} || 0 | 1 }} + {{ #ifeq: {{{30}}} || 0 | 1 }} + {{ #ifeq: {{{31}}} || 0 | 1 }}) mod 2 = 0 | {{{os|}}} | {{{es|}}} }}" | ||
| + | {{{32|}}} }} {{{{#if:{{{32|}}}|1x|void}}| | ||
| + | }}{{#if:{{{33|}}}| | ||
| + | {{!}}- style="{{#ifexpr: ({{ #ifeq: {{{1}}} || 0 | 1 }} + {{ #ifeq: {{{2}}} || 0 | 1 }} + {{ #ifeq: {{{3}}} || 0 | 1 }} + {{ #ifeq: {{{4}}} || 0 | 1 }} + {{ #ifeq: {{{5}}} || 0 | 1 }} + {{ #ifeq: {{{6}}} || 0 | 1 }} + {{ #ifeq: {{{7}}} || 0 | 1 }} + {{ #ifeq: {{{8}}} || 0 | 1 }} + {{ #ifeq: {{{9}}} || 0 | 1 }} + {{ #ifeq: {{{10}}} || 0 | 1 }} + {{ #ifeq: {{{11}}} || 0 | 1 }} + {{ #ifeq: {{{12}}} || 0 | 1 }} + {{ #ifeq: {{{13}}} || 0 | 1 }} + {{ #ifeq: {{{14}}} || 0 | 1 }} + {{ #ifeq: {{{15}}} || 0 | 1 }} + {{ #ifeq: {{{16}}} || 0 | 1 }} + {{ #ifeq: {{{17}}} || 0 | 1 }} + {{ #ifeq: {{{18}}} || 0 | 1 }} + {{ #ifeq: {{{19}}} || 0 | 1 }} + {{ #ifeq: {{{20}}} || 0 | 1 }} + {{ #ifeq: {{{21}}} || 0 | 1 }} + {{ #ifeq: {{{22}}} || 0 | 1 }} + {{ #ifeq: {{{23}}} || 0 | 1 }} + {{ #ifeq: {{{24}}} || 0 | 1 }} + {{ #ifeq: {{{25}}} || 0 | 1 }} + {{ #ifeq: {{{26}}} || 0 | 1 }} + {{ #ifeq: {{{27}}} || 0 | 1 }} + {{ #ifeq: {{{28}}} || 0 | 1 }} + {{ #ifeq: {{{29}}} || 0 | 1 }} + {{ #ifeq: {{{30}}} || 0 | 1 }} + {{ #ifeq: {{{31}}} || 0 | 1 }} + {{ #ifeq: {{{32}}} || 0 | 1 }}) mod 2 = 0 | {{{os|}}} | {{{es|}}} }}" | ||
| + | {{{33|}}} }} {{{{#if:{{{33|}}}|1x|void}}| | ||
| + | }}{{#if:{{{34|}}}| | ||
| + | {{!}}- style="{{#ifexpr: ({{ #ifeq: {{{1}}} || 0 | 1 }} + {{ #ifeq: {{{2}}} || 0 | 1 }} + {{ #ifeq: {{{3}}} || 0 | 1 }} + {{ #ifeq: {{{4}}} || 0 | 1 }} + {{ #ifeq: {{{5}}} || 0 | 1 }} + {{ #ifeq: {{{6}}} || 0 | 1 }} + {{ #ifeq: {{{7}}} || 0 | 1 }} + {{ #ifeq: {{{8}}} || 0 | 1 }} + {{ #ifeq: {{{9}}} || 0 | 1 }} + {{ #ifeq: {{{10}}} || 0 | 1 }} + {{ #ifeq: {{{11}}} || 0 | 1 }} + {{ #ifeq: {{{12}}} || 0 | 1 }} + {{ #ifeq: {{{13}}} || 0 | 1 }} + {{ #ifeq: {{{14}}} || 0 | 1 }} + {{ #ifeq: {{{15}}} || 0 | 1 }} + {{ #ifeq: {{{16}}} || 0 | 1 }} + {{ #ifeq: {{{17}}} || 0 | 1 }} + {{ #ifeq: {{{18}}} || 0 | 1 }} + {{ #ifeq: {{{19}}} || 0 | 1 }} + {{ #ifeq: {{{20}}} || 0 | 1 }} + {{ #ifeq: {{{21}}} || 0 | 1 }} + {{ #ifeq: {{{22}}} || 0 | 1 }} + {{ #ifeq: {{{23}}} || 0 | 1 }} + {{ #ifeq: {{{24}}} || 0 | 1 }} + {{ #ifeq: {{{25}}} || 0 | 1 }} + {{ #ifeq: {{{26}}} || 0 | 1 }} + {{ #ifeq: {{{27}}} || 0 | 1 }} + {{ #ifeq: {{{28}}} || 0 | 1 }} + {{ #ifeq: {{{29}}} || 0 | 1 }} + {{ #ifeq: {{{30}}} || 0 | 1 }} + {{ #ifeq: {{{31}}} || 0 | 1 }} + {{ #ifeq: {{{32}}} || 0 | 1 }} + {{ #ifeq: {{{33}}} || 0 | 1 }}) mod 2 = 0 | {{{os|}}} | {{{es|}}} }}" | ||
| + | {{{34|}}} }} {{{{#if:{{{34|}}}|1x|void}}| | ||
| + | }}{{#if:{{{35|}}}| | ||
| + | {{!}}- style="{{#ifexpr: ({{ #ifeq: {{{1}}} || 0 | 1 }} + {{ #ifeq: {{{2}}} || 0 | 1 }} + {{ #ifeq: {{{3}}} || 0 | 1 }} + {{ #ifeq: {{{4}}} || 0 | 1 }} + {{ #ifeq: {{{5}}} || 0 | 1 }} + {{ #ifeq: {{{6}}} || 0 | 1 }} + {{ #ifeq: {{{7}}} || 0 | 1 }} + {{ #ifeq: {{{8}}} || 0 | 1 }} + {{ #ifeq: {{{9}}} || 0 | 1 }} + {{ #ifeq: {{{10}}} || 0 | 1 }} + {{ #ifeq: {{{11}}} || 0 | 1 }} + {{ #ifeq: {{{12}}} || 0 | 1 }} + {{ #ifeq: {{{13}}} || 0 | 1 }} + {{ #ifeq: {{{14}}} || 0 | 1 }} + {{ #ifeq: {{{15}}} || 0 | 1 }} + {{ #ifeq: {{{16}}} || 0 | 1 }} + {{ #ifeq: {{{17}}} || 0 | 1 }} + {{ #ifeq: {{{18}}} || 0 | 1 }} + {{ #ifeq: {{{19}}} || 0 | 1 }} + {{ #ifeq: {{{20}}} || 0 | 1 }} + {{ #ifeq: {{{21}}} || 0 | 1 }} + {{ #ifeq: {{{22}}} || 0 | 1 }} + {{ #ifeq: {{{23}}} || 0 | 1 }} + {{ #ifeq: {{{24}}} || 0 | 1 }} + {{ #ifeq: {{{25}}} || 0 | 1 }} + {{ #ifeq: {{{26}}} || 0 | 1 }} + {{ #ifeq: {{{27}}} || 0 | 1 }} + {{ #ifeq: {{{28}}} || 0 | 1 }} + {{ #ifeq: {{{29}}} || 0 | 1 }} + {{ #ifeq: {{{30}}} || 0 | 1 }} + {{ #ifeq: {{{31}}} || 0 | 1 }} + {{ #ifeq: {{{32}}} || 0 | 1 }} + {{ #ifeq: {{{33}}} || 0 | 1 }}+ {{ #ifeq: {{{34}}} || 0 | 1 }}) mod 2 = 0 | {{{os|}}} | {{{es|}}} }}" | ||
| + | {{{35|}}} }} {{{{#if:{{{35|}}}|1x|void}}| | ||
}}<noinclude> | }}<noinclude> | ||
{{documentation}} | {{documentation}} | ||
<!-- Add cats and interwikis to the /doc subpage, not here! --> | <!-- Add cats and interwikis to the /doc subpage, not here! --> | ||
</noinclude> | </noinclude> | ||
Latest revision as of 12:38, 20 October 2020
| This is the template sandbox page for Template:Alternating rows table section (diff). See also the companion subpage for test cases. |
| This template uses Lua: |
Usage
Alternating rows table section allows for the dynamic creation of tables that use alternating styles for odd and even numbered rows, typically in conjunction with a template which generates a table where some rows may not be present every time.
The template produces only a portion of the table: this allows for the end user to customize the leading and trailing sections of the table, include secondary rows between sections, or other control elements. This table creates a new row at the start, and the user must start a new row if they want to include additional information after the table section.
There are two named arguments to this template:
- os
- Defines the CSS style for odd-numbered rows.
- es
- Defines the CSS style for even-numbered rows.
Beyond these, the template accepts unnamed parameters, the contents which are appropriate wikimarkup to create a table row as described below. A parameter may be left empty, and will not add to the current row count; in other words, the template tracks how many rows have been defined by the unnamed arguments to determine to apply the odd or even styling.
The unnamed arguments must start with a template-compatible table cell symbol, either "!" for a header, or the use of {{!}} to create the standard cell indicator "|". An argument can contain multiple cells, either separated on lines (using {{!}} to separate cells) or on a single line (using {{!!}} to replace "||" delimiters); cell-specific style arguments can also be applied.
Unpredictable results may happen using other wikitable features such as rowspanning, creating a new row within an argument (using {{!-}}), or the like.
Examples
{| class="wikitable"
! Place !! Result
{{Alternating rows table section|es=background:#f0f0f0;
| {{!}} First {{!!}} 100
| {{!}} Second {{!!}} 95
| <!-- empty! -->
| {{!}} Third {{!!}} 87
| <!-- empty! -->
| {{!}} Fourth {{!!}} 65
| {{!}} Fifth {{!!}} 58
}}
|}
| Place | Result |
|---|---|
| First | 100 |
| Second | 95 |
| Third | 87 |
| Fourth | 65 |
| Fifth | 58 |
{| class="infobox vevent" style="float:left;"
! colspan="2" style="background:#A0A0F0;" | AFC North
{{Alternating rows table section|es=background:#f0f0f0;
| {{!}} Ravens {{!!}} Baltimore
| {{!}} Bengals {{!!}} Cincinnati
| {{!}} Browns {{!!}} Cleveland
| <!-- Empty! -->
| {{!}} Steelers {{!!}} Pittsburgh
}}
|-
! colspan="2" style="background:#A0A0F0;" | AFC East
{{Alternating rows table section|es=background:#f0f0f0;
| {{!}} Bills {{!!}} Buffalo
| {{!}} Dolphins {{!!}} Miami
| <!-- empty! -->
| {{!}} Patroits {{!!}} New England
| {{!}} Jets {{!!}} New York
}}
|}
| AFC North | |
|---|---|
| Ravens | Baltimore |
| Bengals | Cincinnati |
| Browns | Cleveland |
| Steelers | Pittsburgh |
| AFC East | |
| Bills | Buffalo |
| Dolphins | Miami |
| Patroits | New England |
| Jets | New York |
See also
- Web colors provides a list of colours which can be used.
| The above documentation is transcluded from Template:Alternating rows table section/doc. (edit | history) Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages. Please add categories to the /doc subpage. Subpages of this template. |