all repos — grayfriday @ 7ec50399c3d71d9fddbafa5f0d7851602c37fa0f

blackfriday fork with a few changes

Remove 'out' parameter from parser funcs

This only removes the parameter from declarations, everything is broken
at the moment.
Vytautas Ĺ altenis vytas@rtfb.lt
Sun, 01 Nov 2015 21:35:43 +0200
commit

7ec50399c3d71d9fddbafa5f0d7851602c37fa0f

parent

6e42506fcc2ded2963994f47f522405e4d5f7e9f

3 files changed, 32 insertions(+), 32 deletions(-)

jump to
M block.goblock.go

@@ -22,7 +22,7 @@

// Parse block-level data. // Note: this function and many that it calls assume that // the input buffer ends with a newline. -func (p *parser) block(out *bytes.Buffer, data []byte) { +func (p *parser) block(data []byte) { if len(data) == 0 || data[len(data)-1] != '\n' { panic("block input is missing terminating newline") }

@@ -206,7 +206,7 @@ }

return true } -func (p *parser) prefixHeader(out *bytes.Buffer, data []byte) int { +func (p *parser) prefixHeader(data []byte) int { level := 0 for level < 6 && data[level] == '#' { level++

@@ -278,7 +278,7 @@

return 0 } -func (p *parser) titleBlock(out *bytes.Buffer, data []byte, doRender bool) int { +func (p *parser) titleBlock(data []byte, doRender bool) int { if data[0] != '%' { return 0 }

@@ -297,7 +297,7 @@

return len(data) } -func (p *parser) html(out *bytes.Buffer, data []byte, doRender bool) int { +func (p *parser) html(data []byte, doRender bool) int { var i, j int // identify the opening tag

@@ -396,7 +396,7 @@ return i

} // HTML comment, lax form -func (p *parser) htmlComment(out *bytes.Buffer, data []byte, doRender bool) int { +func (p *parser) htmlComment(data []byte, doRender bool) int { i := p.inlineHtmlComment(out, data) // needs to end with a blank line if j := p.isEmpty(data[i:]); j > 0 {

@@ -415,7 +415,7 @@ return 0

} // HR, which is the only self-closing block tag considered -func (p *parser) htmlHr(out *bytes.Buffer, data []byte, doRender bool) int { +func (p *parser) htmlHr(data []byte, doRender bool) int { if data[0] != '<' || (data[1] != 'h' && data[1] != 'H') || (data[2] != 'r' && data[2] != 'R') { return 0 }

@@ -632,7 +632,7 @@ skip = i + 1

return } -func (p *parser) fencedCode(out *bytes.Buffer, data []byte, doRender bool) int { +func (p *parser) fencedCode(data []byte, doRender bool) int { var lang *string beg, marker := p.isFencedCode(data, &lang, "") if beg == 0 || beg >= len(data) {

@@ -678,7 +678,7 @@

return beg } -func (p *parser) table(out *bytes.Buffer, data []byte) int { +func (p *parser) table(data []byte) int { var header bytes.Buffer i, columns := p.tableHeader(&header, data) if i == 0 {

@@ -902,7 +902,7 @@ return p.quotePrefix(data[end:]) == 0 && p.isEmpty(data[end:]) == 0

} // parse a blockquote fragment -func (p *parser) quote(out *bytes.Buffer, data []byte) int { +func (p *parser) quote(data []byte) int { var raw bytes.Buffer beg, end := 0, 0 for beg < len(data) {

@@ -948,7 +948,7 @@ }

return 0 } -func (p *parser) code(out *bytes.Buffer, data []byte) int { +func (p *parser) code(data []byte) int { var work bytes.Buffer i := 0

@@ -1047,7 +1047,7 @@ return i + 2

} // parse ordered or unordered list block -func (p *parser) list(out *bytes.Buffer, data []byte, flags ListType) int { +func (p *parser) list(data []byte, flags ListType) int { i := 0 flags |= ListItemBeginningOfList p.r.BeginList(out, flags)

@@ -1067,7 +1067,7 @@ }

// Parse a single list item. // Assumes initial prefix is already removed if this is a sublist. -func (p *parser) listItem(out *bytes.Buffer, data []byte, flags *ListType) int { +func (p *parser) listItem(data []byte, flags *ListType) int { // keep track of the indentation of the first line itemIndent := 0 for itemIndent < 3 && data[itemIndent] == ' ' {

@@ -1250,7 +1250,7 @@ return line

} // render a single paragraph that has already been parsed out -func (p *parser) renderParagraph(out *bytes.Buffer, data []byte) { +func (p *parser) renderParagraph(data []byte) { if len(data) == 0 { return }

@@ -1274,7 +1274,7 @@ p.inline(out, data[beg:end])

p.r.EndParagraph(out) } -func (p *parser) paragraph(out *bytes.Buffer, data []byte) int { +func (p *parser) paragraph(data []byte) int { // prev: index of 1st char of previous line // line: index of 1st char of current line // i: index of cursor/end of current line
M inline.goinline.go

@@ -29,7 +29,7 @@ // Each function returns the number of chars taken care of

// data is the complete block being rendered // offset is the number of valid chars before the current cursor -func (p *parser) inline(out *bytes.Buffer, data []byte) { +func (p *parser) inline(data []byte) { // this is called recursively: enforce a maximum depth if p.nesting >= p.maxNesting { return

@@ -99,7 +99,7 @@ p.nesting--

} // single and double emphasis parsing -func emphasis(p *parser, out *bytes.Buffer, data []byte, offset int) int { +func emphasis(p *parser, data []byte, offset int) int { data = data[offset:] c := data[0] ret := 0

@@ -142,7 +142,7 @@

return 0 } -func codeSpan(p *parser, out *bytes.Buffer, data []byte, offset int) int { +func codeSpan(p *parser, data []byte, offset int) int { data = data[offset:] nb := 0

@@ -188,7 +188,7 @@

} // newline preceded by two spaces becomes <br> -func maybeLineBreak(p *parser, out *bytes.Buffer, data []byte, offset int) (int, bool) { +func maybeLineBreak(p *parser, data []byte, offset int) (int, bool) { origOffset := offset for offset < len(data) && data[offset] == ' ' { offset++

@@ -203,7 +203,7 @@ return 0, false

} // newline without two spaces works when HardLineBreak is enabled -func lineBreak(p *parser, out *bytes.Buffer, data []byte, offset int) int { +func lineBreak(p *parser, data []byte, offset int) int { if p.flags&HardLineBreak != 0 { p.r.LineBreak(out) return 1

@@ -227,14 +227,14 @@ }

return pos < len(data)-1 && data[pos] == '[' && data[pos+1] != '^' } -func maybeImage(p *parser, out *bytes.Buffer, data []byte, offset int) int { +func maybeImage(p *parser, data []byte, offset int) int { if offset < len(data)-1 && data[offset+1] == '[' { return link(p, out, data, offset) } return 0 } -func maybeInlineFootnote(p *parser, out *bytes.Buffer, data []byte, offset int) int { +func maybeInlineFootnote(p *parser, data []byte, offset int) int { if offset < len(data)-1 && data[offset+1] == '[' { return link(p, out, data, offset) }

@@ -242,7 +242,7 @@ return 0

} // '[': parse a link or an image or a footnote -func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { +func link(p *parser, data []byte, offset int) int { // no links allowed inside regular links, footnote, and deferred footnotes if p.insideLink && (offset > 0 && data[offset-1] == '[' || len(data)-1 > offset && data[offset+1] == '^') { return 0

@@ -595,7 +595,7 @@

return i } -func (p *parser) inlineHtmlComment(out *bytes.Buffer, data []byte) int { +func (p *parser) inlineHtmlComment(data []byte) int { if len(data) < 5 { return 0 }

@@ -615,7 +615,7 @@ return i + 1

} // '<' when tags or autolinks are allowed -func leftAngle(p *parser, out *bytes.Buffer, data []byte, offset int) int { +func leftAngle(p *parser, data []byte, offset int) int { data = data[offset:] altype := LinkTypeNotAutolink end := tagLength(data, &altype)

@@ -640,7 +640,7 @@

// '\\' backslash escape var escapeChars = []byte("\\`*_{}[]()#+-.!:|&<>~") -func escape(p *parser, out *bytes.Buffer, data []byte, offset int) int { +func escape(p *parser, data []byte, offset int) int { data = data[offset:] if len(data) > 1 {

@@ -681,7 +681,7 @@ }

// '&' escaped when it doesn't belong to an entity // valid entities are assumed to be anything matching &#?[A-Za-z0-9]+; -func entity(p *parser, out *bytes.Buffer, data []byte, offset int) int { +func entity(p *parser, data []byte, offset int) int { data = data[offset:] end := 1

@@ -710,7 +710,7 @@ entityRanges := htmlEntity.FindAllIndex(data[:linkEnd], -1)

return entityRanges != nil && entityRanges[len(entityRanges)-1][1] == linkEnd } -func maybeAutoLink(p *parser, out *bytes.Buffer, data []byte, offset int) int { +func maybeAutoLink(p *parser, data []byte, offset int) int { // quick check to rule out most false hits if p.insideLink || len(data) < offset+6 { // 6 is the len() of the shortest prefix below return 0

@@ -735,7 +735,7 @@ }

return 0 } -func autoLink(p *parser, out *bytes.Buffer, data []byte, offset int) int { +func autoLink(p *parser, data []byte, offset int) int { // Now a more expensive check to see if we're not inside an anchor element anchorStart := offset offsetFromAnchor := 0

@@ -1068,7 +1068,7 @@ }

return 0 } -func helperEmphasis(p *parser, out *bytes.Buffer, data []byte, c byte) int { +func helperEmphasis(p *parser, data []byte, c byte) int { i := 0 // skip one symbol if coming from emph3

@@ -1109,7 +1109,7 @@

return 0 } -func helperDoubleEmphasis(p *parser, out *bytes.Buffer, data []byte, c byte) int { +func helperDoubleEmphasis(p *parser, data []byte, c byte) int { i := 0 for i < len(data) {

@@ -1138,7 +1138,7 @@ }

return 0 } -func helperTripleEmphasis(p *parser, out *bytes.Buffer, data []byte, offset int, c byte) int { +func helperTripleEmphasis(p *parser, data []byte, offset int, c byte) int { i := 0 origData := data data = data[offset:]
M markdown.gomarkdown.go

@@ -206,7 +206,7 @@ }

// Callback functions for inline parsing. One such function is defined // for each character that triggers a response when parsing inline data. -type inlineParser func(p *parser, out *bytes.Buffer, data []byte, offset int) int +type inlineParser func(p *parser, data []byte, offset int) int // Parser holds runtime state used by the parser. // This is constructed by the Markdown function.