comments, minor cleanups

This commit is contained in:
Russ Ross 2011-05-31 16:28:07 -06:00
parent b6e6530815
commit 921ac7d0be
2 changed files with 25 additions and 22 deletions

View File

@ -562,7 +562,10 @@ func blockFencedCode(out *bytes.Buffer, rndr *render, data []byte) int {
func blockTable(out *bytes.Buffer, rndr *render, data []byte) int {
var header_work bytes.Buffer
i, columns, col_data := blockTableHeader(&header_work, rndr, data)
if i > 0 {
if i == 0 {
return 0
}
var body_work bytes.Buffer
for i < len(data) {
@ -585,7 +588,6 @@ func blockTable(out *bytes.Buffer, rndr *render, data []byte) int {
if rndr.mk.Table != nil {
rndr.mk.Table(out, header_work.Bytes(), body_work.Bytes(), col_data, rndr.mk.Opaque)
}
}
return i
}

View File

@ -20,6 +20,7 @@ import (
// offset is the number of valid chars before the current cursor
func parseInline(out *bytes.Buffer, rndr *render, data []byte) {
// this is called recursively: enforce a maximum depth
if rndr.nesting >= rndr.maxNesting {
return
}
@ -45,12 +46,12 @@ func parseInline(out *bytes.Buffer, rndr *render, data []byte) {
// call the trigger
parser := rndr.inline[data[end]]
end = parser(out, rndr, data, i)
if end == 0 { // no action from the callback
if consumed := parser(out, rndr, data, i); consumed == 0 {
// no action from the callback; buffer the byte for later
end = i + 1
} else {
i += end
// skip past whatever the callback used
i += consumed
end = i
}
}