-
Notifications
You must be signed in to change notification settings - Fork 0
/
table_row.go
39 lines (31 loc) · 679 Bytes
/
table_row.go
1
2
3
4
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
34
35
36
37
38
39
// SPDX-FileCopyrightText: 2020 M. Shulhan <[email protected]>
// SPDX-License-Identifier: GPL-3.0-or-later
package asciidoctor
import "bytes"
type tableRow struct {
cells []*tableCell
ncell int
}
func (row *tableRow) add(cell *tableCell) {
row.cells = append(row.cells, cell)
row.ncell++
var x int
for x = 1; x < cell.format.ndupCol; x++ {
row.cells = append(row.cells, cell)
row.ncell++
}
if cell.format.nspanCol > 0 {
row.ncell += (cell.format.nspanCol - 1)
}
}
func (row *tableRow) String() string {
var (
buf bytes.Buffer
cell *tableCell
)
for _, cell = range row.cells {
buf.WriteByte('|')
buf.Write(cell.content)
}
return buf.String()
}