From 77fcc38a9a906d6a44ab2eac971714bba1970115 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 12 Sep 2010 19:30:40 +0200 Subject: simple table cells may spread vertically --- rst_helpers.lua | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/rst_helpers.lua b/rst_helpers.lua index 7598698..4faecbd 100644 --- a/rst_helpers.lua +++ b/rst_helpers.lua @@ -480,6 +480,15 @@ end +function helpers.table.resolve_parent (row, col, array) + local cell = array[row][col] + local par_row, par_col = row, col + if cell.parent then + par_row, par_col = self.resolve_parent(cell.parent.y, cell.parent.x) + end + return par_row, par_col +end + -- Check the column boundaries of a simple table. function helpers.get_st_boundaries (str) @@ -546,7 +555,6 @@ function helpers.table.simple(raw) end end cell.span.x = 1 + stop_at - start_at - print(start_at, stop_at, cell.span.x) end newrow[nc] = cell end @@ -562,6 +570,20 @@ function helpers.table.simple(raw) end rows[nr] = newrow end + + for nr, row in ipairs(rows) do + if not row.ignore and row[1].content == "" then + row.ignore = true + for nc, cell in ipairs(row) do + local par_row, par_col = helpers.table.resolve_parent(nr - 1, nc, rows) + parent = rows[par_row][par_col] + parent.content = parent.content .. " " .. cell.content + cell.content = "" + end + + end + end + return rows end -- cgit v1.2.3