all repos — grayfriday @ cd2f07914086ce83562503391104a51d74a62106

blackfriday fork with a few changes

More lint: inline.go
Vytautas Ĺ altenis vytas@rtfb.lt
Wed, 27 Jul 2016 21:31:29 +0300
commit

cd2f07914086ce83562503391104a51d74a62106

parent

e054c962e7e3592790620265d793539b1e8b6029

2 files changed, 10 insertions(+), 14 deletions(-)

jump to
M block.goblock.go

@@ -427,7 +427,7 @@ }

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

@@ -266,13 +266,13 @@ t = linkDeferredFootnote

// ![alt] == image case offset >= 0 && data[offset] == '!': t = linkImg - offset += 1 + offset++ // ^[text] == inline footnote // [^refId] == deferred footnote case p.flags&Footnotes != 0: if offset >= 0 && data[offset] == '^' { t = linkInlineFootnote - offset += 1 + offset++ } else if len(data)-1 > offset && data[offset+1] == '^' { t = linkDeferredFootnote }

@@ -590,7 +590,7 @@ linkNode.Destination = uLink

linkNode.Title = title p.currBlock.appendChild(linkNode) linkNode.appendChild(text(data[1:txtE])) - i += 1 + i++ case linkInlineFootnote, linkDeferredFootnote: linkNode := NewNode(Link)

@@ -609,7 +609,7 @@

return i } -func (p *parser) inlineHtmlComment(data []byte) int { +func (p *parser) inlineHTMLComment(data []byte) int { if len(data) < 5 { return 0 }

@@ -643,7 +643,7 @@ func leftAngle(p *parser, data []byte, offset int) int {

data = data[offset:] altype := LinkTypeNotAutolink end := tagLength(data, &altype) - if size := p.inlineHtmlComment(data); size > 0 { + if size := p.inlineHTMLComment(data); size > 0 { end = size } if end > 2 {

@@ -1026,9 +1026,8 @@

case '>': if nb == 1 { return i + 1 - } else { - return 0 } + return 0 default: return 0 }

@@ -1091,9 +1090,8 @@ }

if data[i] != '[' && data[i] != '(' { // not a link if tmpI > 0 { return tmpI - } else { - continue } + continue } cc := data[i] i++

@@ -1218,17 +1216,15 @@ // double symbol found, hand over to emph1

length = helperEmphasis(p, origData[offset-2:], c) if length == 0 { return 0 - } else { - return length - 2 } + return length - 2 default: // single symbol found, hand over to emph2 length = helperDoubleEmphasis(p, origData[offset-1:], c) if length == 0 { return 0 - } else { - return length - 1 } + return length - 1 } } return 0