Skip to content

Commit 337f1fb

Browse files
not-my-profiletarleb
authored andcommitted
list-table: fix colspan in first row
1 parent b1a13fa commit 337f1fb

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

list-table/expected.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,16 @@
9191
</tr>
9292
</tbody>
9393
</table>
94+
<table>
95+
<thead>
96+
<tr class="header">
97+
<th colspan="2">header</th>
98+
</tr>
99+
</thead>
100+
<tbody>
101+
<tr class="odd">
102+
<td>cell 1</td>
103+
<td>cell 2</td>
104+
</tr>
105+
</tbody>
106+
</table>

list-table/list-table.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,12 @@ local function process(div)
133133
local header_col_count = tonumber(div.attr.attributes['header-cols']) or 0
134134
div.attr.attributes['header-cols'] = nil
135135

136-
local colspecs = get_colspecs(div.attr.attributes, #rows[1][2])
136+
local column_count = 0
137+
for i = 1, #rows[1][2] do
138+
column_count = column_count + rows[1][2][i].col_span
139+
end
140+
141+
local colspecs = get_colspecs(div.attr.attributes, column_count)
137142
local thead_rows = {}
138143
for i = 1, header_row_count do
139144
table.insert(thead_rows, table.remove(rows, 1))

list-table/sample.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,9 @@
5454
* - reStructuredText
5555
- []{align=c} ` ``code`` `
5656
:::
57+
58+
::: list-table
59+
* - []{colspan=2}header
60+
* - cell 1
61+
- cell 2
62+
:::

0 commit comments

Comments
 (0)