From cd2f07914086ce83562503391104a51d74a62106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vytautas=20=C5=A0altenis?= Date: Wed, 27 Jul 2016 21:31:29 +0300 Subject: [PATCH] More lint: inline.go --- block.go | 2 +- inline.go | 22 +++++++++------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/block.go b/block.go index a5f59a1..c347965 100644 --- a/block.go +++ b/block.go @@ -427,7 +427,7 @@ func finalizeHtmlBlock(block *Node) { // 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 diff --git a/inline.go b/inline.go index edde056..d051ead 100644 --- a/inline.go +++ b/inline.go @@ -266,13 +266,13 @@ func link(p *parser, data []byte, offset int) int { // ![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 @@ func link(p *parser, data []byte, offset int) int { 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 @@ func link(p *parser, data []byte, offset int) int { 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 @@ func isMailtoAutoLink(data []byte) int { case '>': if nb == 1 { return i + 1 - } else { - return 0 } + return 0 default: return 0 } @@ -1091,9 +1090,8 @@ func helperFindEmphChar(data []byte, c byte) int { if data[i] != '[' && data[i] != '(' { // not a link if tmpI > 0 { return tmpI - } else { - continue } + continue } cc := data[i] i++ @@ -1218,17 +1216,15 @@ func helperTripleEmphasis(p *parser, data []byte, offset int, c byte) int { 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