summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2010-09-12 19:30:40 +0200
committerPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2010-09-12 19:30:40 +0200
commit77fcc38a9a906d6a44ab2eac971714bba1970115 (patch)
treea9251471b5aa43b0e1bc5287b9658c3a8b134001
parent76cf9b771dd680c4b05c2a0c59c0ec84d0f36b0d (diff)
downloadcontext-rst-77fcc38a9a906d6a44ab2eac971714bba1970115.tar.gz
simple table cells may spread vertically
-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