Skip to content

Commit 08654dd

Browse files
committed
Add a wrapper element for tables
1 parent 22d0822 commit 08654dd

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<div class="table-wrapper">
2+
<table{% if tableNode.classes %} class="{{ tableNode.classesString }}"{% endif %}>
3+
{% if tableHeaderRows is not empty %}
4+
<thead>
5+
{% for tableHeaderRow in tableHeaderRows %}
6+
<tr>
7+
{% for column in tableHeaderRow.columns %}
8+
<th{% if column.colspan > 1 %} colspan="{{ column.colspan }}"{% endif %}>{{ column.render|raw }}</th>
9+
{% endfor %}
10+
</tr>
11+
{% endfor %}
12+
</thead>
13+
{% endif %}
14+
<tbody>
15+
{% for tableRow in tableRows %}
16+
<tr>
17+
{% for column in tableRow.columns %}
18+
<td{% if column.colSpan > 1 %} colspan="{{ column.colSpan }}"{% endif %}{% if column.rowSpan > 1 %} rowspan="{{ column.rowSpan }}"{% endif %}>{{ column.render|raw }}</td>
19+
{% endfor %}
20+
</tr>
21+
{% endfor %}
22+
</tbody>
23+
</table>
24+
</div>

tests/fixtures/expected/blocks/nodes/tables.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<p>Simple table with head:</p>
22

3+
<div class="table-wrapper">
34
<table>
45
<thead>
56
<tr>
@@ -21,9 +22,11 @@
2122
</tr>
2223
</tbody>
2324
</table>
25+
</div>
2426

2527
<p>Simple table headless:</p>
2628

29+
<div class="table-wrapper">
2730
<table>
2831
<tbody>
2932
<tr>
@@ -38,9 +41,11 @@
3841
</tr>
3942
</tbody>
4043
</table>
44+
</div>
4145

4246
<p>Grid table:</p>
4347

48+
<div class="table-wrapper">
4449
<table>
4550
<tbody>
4651
<tr>
@@ -58,9 +63,11 @@
5863
</tr>
5964
</tbody>
6065
</table>
66+
</div>
6167

6268
<p>Grid table with head:</p>
6369

70+
<div class="table-wrapper">
6471
<table>
6572
<thead>
6673
<tr>
@@ -80,9 +87,11 @@
8087
</tr>
8188
</tbody>
8289
</table>
90+
</div>
8391

8492
<p>Grid table with head and multi-line cells:</p>
8593

94+
<div class="table-wrapper">
8695
<table>
8796
<thead>
8897
<tr>
@@ -110,3 +119,4 @@
110119
</tr>
111120
</tbody>
112121
</table>
122+
</div>

0 commit comments

Comments
 (0)