Remove callback from Paragraph renderer event Split Paragraph into two events: BeginParagraph and EndParagraph, removing the need for callback.
Vytautas Ĺ altenis vytas@rtfb.lt
Mon, 26 Oct 2015 20:35:42 +0200
4 files changed,
13 insertions(+),
10 deletions(-)
M
block.go
→
block.go
@@ -1269,10 +1269,9 @@ for end > beg && data[end-1] == ' ' {
end-- } - work := func() { - p.inline(out, data[beg:end]) - } - p.r.Paragraph(out, work) + p.r.BeginParagraph(out) + p.inline(out, data[beg:end]) + p.r.EndParagraph(out) } func (p *parser) paragraph(out *bytes.Buffer, data []byte) int {
M
html.go
→
html.go
@@ -418,11 +418,12 @@ out.WriteString("</li>\n")
} } -func (options *Html) Paragraph(out *bytes.Buffer, text func()) { +func (r *Html) BeginParagraph(out *bytes.Buffer) { doubleSpace(out) + out.WriteString("<p>") +} - out.WriteString("<p>") - text() +func (r *Html) EndParagraph(out *bytes.Buffer) { out.WriteString("</p>\n") }
M
latex.go
→
latex.go
@@ -119,9 +119,11 @@ out.WriteString("\n\\item ")
out.Write(text) } -func (options *Latex) Paragraph(out *bytes.Buffer, text func()) { +func (r *Latex) BeginParagraph(out *bytes.Buffer) { out.WriteString("\n") - text() +} + +func (r *Latex) EndParagraph(out *bytes.Buffer) { out.WriteString("\n") }
M
markdown.go
→
markdown.go
@@ -169,7 +169,8 @@ HRule(out *bytes.Buffer)
BeginList(out *bytes.Buffer, flags ListType) EndList(out *bytes.Buffer, flags ListType) ListItem(out *bytes.Buffer, text []byte, flags ListType) - Paragraph(out *bytes.Buffer, text func()) + BeginParagraph(out *bytes.Buffer) + EndParagraph(out *bytes.Buffer) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) TableRow(out *bytes.Buffer, text []byte) TableHeaderCell(out *bytes.Buffer, text []byte, flags int)