5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/slaw/grammars/tables_nodes.rb', line 5
def to_xml(b, idprefix, i=0)
cnt = Slaw::Grammars::Counters.counters[idprefix]['table'] += 1
b.table(eId: "#{idprefix}table_#{cnt}") { |b|
rows = []
cells = []
for child in table_body.elements
if child.is_a? TableCell
cells << child
else
rows << cells unless cells.empty?
cells = []
end
end
rows << cells unless cells.empty?
for row in rows
b.tr { |tr|
for cell in row
cell.to_xml(tr, "")
end
}
end
}
end
|