mirror of
https://github.com/danog/blackfriday.git
synced 2024-11-26 20:14:43 +01:00
Fix rendering of tables
Add proper capture groups to fix the order of bits and pieces.
This commit is contained in:
parent
d1b544e278
commit
f8378658c0
10
block.go
10
block.go
@ -689,6 +689,7 @@ func (p *parser) table(data []byte) int {
|
||||
|
||||
var body bytes.Buffer
|
||||
|
||||
body.Write(p.r.CaptureWrites(func() {
|
||||
for i < len(data) {
|
||||
pipes, rowStart := 0, i
|
||||
for ; data[i] != '\n'; i++ {
|
||||
@ -704,8 +705,9 @@ func (p *parser) table(data []byte) int {
|
||||
|
||||
// include the newline in data sent to tableRow
|
||||
i++
|
||||
p.tableRow(&body, data[rowStart:i], columns, false)
|
||||
p.tableRow(data[rowStart:i], columns, false)
|
||||
}
|
||||
}))
|
||||
|
||||
p.r.Table(header.Bytes(), body.Bytes(), columns)
|
||||
|
||||
@ -819,12 +821,14 @@ func (p *parser) tableHeader(out *bytes.Buffer, data []byte) (size int, columns
|
||||
return
|
||||
}
|
||||
|
||||
p.tableRow(out, header, columns, true)
|
||||
out.Write(p.r.CaptureWrites(func() {
|
||||
p.tableRow(header, columns, true)
|
||||
}))
|
||||
size = i + 1
|
||||
return
|
||||
}
|
||||
|
||||
func (p *parser) tableRow(out *bytes.Buffer, data []byte, columns []int, header bool) {
|
||||
func (p *parser) tableRow(data []byte, columns []int, header bool) {
|
||||
i, col := 0, 0
|
||||
var rowWork bytes.Buffer
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user