From f9b1bfd1b034b12e57d892034b8caf9c34661803 Mon Sep 17 00:00:00 2001 From: PgBiel <9021226+PgBiel@users.noreply.github.com> Date: Thu, 12 Jun 2025 02:17:11 -0300 Subject: [PATCH] fix tfoot in table html --- crates/typst-library/src/model/table.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/typst-library/src/model/table.rs b/crates/typst-library/src/model/table.rs index 367d3e66f..917953981 100644 --- a/crates/typst-library/src/model/table.rs +++ b/crates/typst-library/src/model/table.rs @@ -297,7 +297,7 @@ fn show_cellgrid_html(grid: CellGrid, styles: StyleChain) -> Content { // appear to be an equivalent of 'th' for footers in HTML.) // TODO: test let footer = { - let mut consecutive_footer_start = grid.footers.len(); + let mut consecutive_footer_start = grid.rows.len(); let footers_at_end = grid .footers .iter() @@ -312,7 +312,9 @@ fn show_cellgrid_html(grid: CellGrid, styles: StyleChain) -> Content { if footers_at_end > 0 { let last_mid_table_footer = grid.footers.len() - footers_at_end; - let rows = rows.drain(last_mid_table_footer..); + let removed_footer_rows = + grid.footers.get(last_mid_table_footer).unwrap().start; + let rows = rows.drain(removed_footer_rows..); Some(elem(tag::tfoot, Content::sequence(rows.map(|row| tr(tag::td, row))))) } else {