diff --git a/news/changelog-1.9.md b/news/changelog-1.9.md index 8c1e5fafb8..a4bc16030f 100644 --- a/news/changelog-1.9.md +++ b/news/changelog-1.9.md @@ -197,6 +197,7 @@ All changes included in 1.9: - ([#13528](https://github.com/quarto-dev/quarto-cli/pull/13528)): Adds support for table specification using nested lists and the `list-table` class. - ([#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`. - ([#13656](https://github.com/quarto-dev/quarto-cli/issues/13656)): Fix R code cells with empty `lang: ""` option producing invalid markdown class attributes. +- ([#13776](https://github.com/quarto-dev/quarto-cli/issues/13776)): Do not process tblwidths attributes for non-simple tables, since this breaks rowspan handling. - ([#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) - ([#13856](https://github.com/quarto-dev/quarto-cli/issues/13856)): Add code annotation support for Typst and Observable.js code blocks. (author: @mcanouil) - ([#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. diff --git a/src/resources/filters/modules/import_all.lua b/src/resources/filters/modules/import_all.lua index ce87e0c489..61429636fc 100644 --- a/src/resources/filters/modules/import_all.lua +++ b/src/resources/filters/modules/import_all.lua @@ -21,7 +21,8 @@ _quarto.modules = { string = require("modules/string"), tablecolwidths = require("modules/tablecolwidths"), typst = require("modules/typst"), - listtable = require("modules/listtable") + listtable = require("modules/listtable"), + tableutils = require("modules/tableutils"), } quarto.brand = _quarto.modules.brand diff --git a/src/resources/filters/modules/tablecolwidths.lua b/src/resources/filters/modules/tablecolwidths.lua index 6f7091ef5e..f7adc938be 100644 --- a/src/resources/filters/modules/tablecolwidths.lua +++ b/src/resources/filters/modules/tablecolwidths.lua @@ -83,6 +83,22 @@ local function tblColwidthValues(tbl, tblColwidths) end local function resolve_table_colwidths_scoped(tbl, scope) + local all_cells = require("modules/tableutils").all_cells + local function is_simple(tbl) + for cell in all_cells(tbl) do + if cell.col_span ~= 1 or cell.row_span ~= 1 then + return false + end + end + return true + end + -- https://github.com/quarto-dev/quarto-cli/issues/13776: do + -- not process a table with to_simple_table/from_simple_table + -- roundtrip is table isn't simple + if not is_simple(tbl) then + return nil + end + -- see if we have a tbl-colwidths attribute local tblColwidths = nil if tbl.caption.long ~= nil and #tbl.caption.long > 0 then diff --git a/src/resources/filters/modules/tableutils.lua b/src/resources/filters/modules/tableutils.lua new file mode 100644 index 0000000000..5b759acc73 --- /dev/null +++ b/src/resources/filters/modules/tableutils.lua @@ -0,0 +1,33 @@ +return { + all_cells = function (tbl) + return coroutine.wrap(function() + -- head rows + for _, row in ipairs(tbl.head.rows) do + for _, cell in ipairs(row.cells) do + coroutine.yield(cell) + end + end + -- body sections + for _, body in ipairs(tbl.bodies) do + -- intermediate head rows + for _, row in ipairs(body.head) do + for _, cell in ipairs(row.cells) do + coroutine.yield(cell) + end + end + -- body rows + for _, row in ipairs(body.body) do + for _, cell in ipairs(row.cells) do + coroutine.yield(cell) + end + end + end + -- foot rows + for _, row in ipairs(tbl.foot.rows) do + for _, cell in ipairs(row.cells) do + coroutine.yield(cell) + end + end + end) + end +} \ No newline at end of file diff --git a/tests/docs/smoke-all/2026/02/23/issue-13776.qmd b/tests/docs/smoke-all/2026/02/23/issue-13776.qmd new file mode 100644 index 0000000000..345e7a6002 --- /dev/null +++ b/tests/docs/smoke-all/2026/02/23/issue-13776.qmd @@ -0,0 +1,28 @@ +--- +format: html +title: Hello +_quarto: + tests: + html: + ensureFileRegexMatches: + - + - "rowspan.*2.*Yes rows" + - + - "rowspan.*2.*No rows" +--- + ++--------------+----------------------+ +| Col1 | Col2 | ++==============+======================+ +| **Yes rows** | | +| +----------------------+ +| | Row2 | ++--------------+----------------------+ + ++-------------+----------------------+ +| Col1 | Col2 | ++=============+======================+ +| **No rows** | | ++-------------+----------------------+ +| | Row2 | ++-------------+----------------------+