More lint: inline.go

This commit is contained in:
Vytautas Šaltenis 2016-07-27 21:31:29 +03:00
parent e054c962e7
commit cd2f079140
2 changed files with 10 additions and 14 deletions

View File

@ -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

View File

@ -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