Difference between revisions of "Template:Responsive table header"

From Yugipedia
Jump to: navigation, search
(MediaWiki doesn't use thead. A custom class is probably safer to use than assuming "... > tr:first-child" is the heading row.)
(One parameter with each column on a new line, instead of a parameter per column.)
Line 1: Line 1:
{| class="wikitable wikitable--responsive-labels sortable card-list" style="{{ #arraymap: 1, 2, 3, 4, 5, 6, 7, 8<includeonly>, 9, 10, 11, 12, 13, 14</includeonly>
+
<!--
|,
+
-->{{ #arraydefine: $columns | {{{columns<includeonly>|</includeonly>}}} | \n }}<!--
| $column_number$
+
-->{{ #vardefine: $column_number | 0 }}<!--
| {{ #if: {{{column$column_number$<includeonly>|</includeonly>}}} |
+
 
--column$column_number$: {{unlink|{{ #explode: {{{column$column_number$}}} | ; }}}};
+
-->{| class="wikitable wikitable--responsive-labels sortable card-list" style="{{ #arrayprint: $columns
  }}
+
|
 +
| $column$
 +
| <!--
 +
  -->{{ #vardefine: $column_number | {{ #expr: {{ #var: $column_number }} + 1 }} }}<!--
 +
  -->--column{{ #var: $column_number }}: {{unlink|{{ #explode: $column$ | ; }}}};
 
|  
 
|  
 
}}"
 
}}"
 
|- class="wikitable__heading"
 
|- class="wikitable__heading"
{{ #arraymap: 1, 2, 3, 4, 5, 6, 7, 8<includeonly>, 9, 10, 11, 12, 13, 14</includeonly>
+
<!--
|,
+
-->{{ #vardefine: $column_number | 0 }}<!-- #reset counter
| $column_number$
+
-->{{ #arrayprint: $columns
| {{ #if: {{{column$column_number$<includeonly>|</includeonly>}}} |
+
|
! scope="col" {{!}} {{ #explode: {{{column$column_number$}}} | ; | -1 }}
+
| $column$
  }}
+
| {{ #vardefine: $column_number | {{ #expr: {{ #var: $column_number }} + 1 }} }}
 +
! scope="col" {{!}} {{ #explode: $column$ | ; | -1 }}
 
|\n
 
|\n
 
}}
 
}}

Revision as of 15:33, 1 January 2020

{{{columns}}}