Skip to content

Commit f1f3c6e

Browse files
authored
skip processing non-simple tables (#13776)
* skip processing non-simple tables (#13776)
1 parent 4c60a3e commit f1f3c6e

5 files changed

Lines changed: 80 additions & 1 deletion

File tree

news/changelog-1.9.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ All changes included in 1.9:
198198
- ([#13528](https://github.com/quarto-dev/quarto-cli/pull/13528)): Adds support for table specification using nested lists and the `list-table` class.
199199
- ([#13575](https://github.com/quarto-dev/quarto-cli/pull/13575)): Improve CPU architecture detection/reporting in macOS to allow quarto to run in virtualized environments such as OpenAI's `codex`.
200200
- ([#13656](https://github.com/quarto-dev/quarto-cli/issues/13656)): Fix R code cells with empty `lang: ""` option producing invalid markdown class attributes.
201+
- ([#13776](https://github.com/quarto-dev/quarto-cli/issues/13776)): Do not process tblwidths attributes for non-simple tables, since this breaks rowspan handling.
201202
- ([#13832](https://github.com/quarto-dev/quarto-cli/pull/13832)): Fix `license.text` metadata not being accessible when using an inline license (`license: "text"`), and populate it with the license name for CC licenses instead of empty string. (author: @mcanouil)
202203
- ([#13856](https://github.com/quarto-dev/quarto-cli/issues/13856)): Add code annotation support for Typst and Observable.js code blocks. (author: @mcanouil)
203204
- ([#13890](https://github.com/quarto-dev/quarto-cli/issues/13890)): Fix render failure when using `embed-resources: true` with input path through a symlinked directory. The cleanup now resolves symlinks before comparing paths.

src/resources/filters/modules/import_all.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ _quarto.modules = {
2121
string = require("modules/string"),
2222
tablecolwidths = require("modules/tablecolwidths"),
2323
typst = require("modules/typst"),
24-
listtable = require("modules/listtable")
24+
listtable = require("modules/listtable"),
25+
tableutils = require("modules/tableutils"),
2526
}
2627

2728
quarto.brand = _quarto.modules.brand

src/resources/filters/modules/tablecolwidths.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,22 @@ local function tblColwidthValues(tbl, tblColwidths)
8383
end
8484

8585
local function resolve_table_colwidths_scoped(tbl, scope)
86+
local all_cells = require("modules/tableutils").all_cells
87+
local function is_simple(tbl)
88+
for cell in all_cells(tbl) do
89+
if cell.col_span ~= 1 or cell.row_span ~= 1 then
90+
return false
91+
end
92+
end
93+
return true
94+
end
95+
-- https://github.com/quarto-dev/quarto-cli/issues/13776: do
96+
-- not process a table with to_simple_table/from_simple_table
97+
-- roundtrip is table isn't simple
98+
if not is_simple(tbl) then
99+
return nil
100+
end
101+
86102
-- see if we have a tbl-colwidths attribute
87103
local tblColwidths = nil
88104
if tbl.caption.long ~= nil and #tbl.caption.long > 0 then
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
return {
2+
all_cells = function (tbl)
3+
return coroutine.wrap(function()
4+
-- head rows
5+
for _, row in ipairs(tbl.head.rows) do
6+
for _, cell in ipairs(row.cells) do
7+
coroutine.yield(cell)
8+
end
9+
end
10+
-- body sections
11+
for _, body in ipairs(tbl.bodies) do
12+
-- intermediate head rows
13+
for _, row in ipairs(body.head) do
14+
for _, cell in ipairs(row.cells) do
15+
coroutine.yield(cell)
16+
end
17+
end
18+
-- body rows
19+
for _, row in ipairs(body.body) do
20+
for _, cell in ipairs(row.cells) do
21+
coroutine.yield(cell)
22+
end
23+
end
24+
end
25+
-- foot rows
26+
for _, row in ipairs(tbl.foot.rows) do
27+
for _, cell in ipairs(row.cells) do
28+
coroutine.yield(cell)
29+
end
30+
end
31+
end)
32+
end
33+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
format: html
3+
title: Hello
4+
_quarto:
5+
tests:
6+
html:
7+
ensureFileRegexMatches:
8+
-
9+
- "rowspan.*2.*Yes rows"
10+
-
11+
- "rowspan.*2.*No rows"
12+
---
13+
14+
+--------------+----------------------+
15+
| Col1 | Col2 |
16+
+==============+======================+
17+
| **Yes rows** | <http://example.com> |
18+
| +----------------------+
19+
| | Row2 |
20+
+--------------+----------------------+
21+
22+
+-------------+----------------------+
23+
| Col1 | Col2 |
24+
+=============+======================+
25+
| **No rows** | <http://example.com> |
26+
+-------------+----------------------+
27+
| | Row2 |
28+
+-------------+----------------------+

0 commit comments

Comments
 (0)