summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rst_helpers.lua24
1 files changed, 23 insertions, 1 deletions
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