mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
Merge pull request #171 from moorereason/unused-buf
Remove unnecessary buffer
This commit is contained in:
commit
033db7dd82
1 changed files with 0 additions and 5 deletions
|
|
@ -290,20 +290,17 @@ func (s *linkParser) parseLink(parent ast.Node, last *linkLabelState, block text
|
||||||
func parseLinkDestination(block text.Reader) ([]byte, bool) {
|
func parseLinkDestination(block text.Reader) ([]byte, bool) {
|
||||||
block.SkipSpaces()
|
block.SkipSpaces()
|
||||||
line, _ := block.PeekLine()
|
line, _ := block.PeekLine()
|
||||||
buf := []byte{}
|
|
||||||
if block.Peek() == '<' {
|
if block.Peek() == '<' {
|
||||||
i := 1
|
i := 1
|
||||||
for i < len(line) {
|
for i < len(line) {
|
||||||
c := line[i]
|
c := line[i]
|
||||||
if c == '\\' && i < len(line)-1 && util.IsPunct(line[i+1]) {
|
if c == '\\' && i < len(line)-1 && util.IsPunct(line[i+1]) {
|
||||||
buf = append(buf, '\\', line[i+1])
|
|
||||||
i += 2
|
i += 2
|
||||||
continue
|
continue
|
||||||
} else if c == '>' {
|
} else if c == '>' {
|
||||||
block.Advance(i + 1)
|
block.Advance(i + 1)
|
||||||
return line[1:i], true
|
return line[1:i], true
|
||||||
}
|
}
|
||||||
buf = append(buf, c)
|
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
return nil, false
|
return nil, false
|
||||||
|
|
@ -313,7 +310,6 @@ func parseLinkDestination(block text.Reader) ([]byte, bool) {
|
||||||
for i < len(line) {
|
for i < len(line) {
|
||||||
c := line[i]
|
c := line[i]
|
||||||
if c == '\\' && i < len(line)-1 && util.IsPunct(line[i+1]) {
|
if c == '\\' && i < len(line)-1 && util.IsPunct(line[i+1]) {
|
||||||
buf = append(buf, '\\', line[i+1])
|
|
||||||
i += 2
|
i += 2
|
||||||
continue
|
continue
|
||||||
} else if c == '(' {
|
} else if c == '(' {
|
||||||
|
|
@ -326,7 +322,6 @@ func parseLinkDestination(block text.Reader) ([]byte, bool) {
|
||||||
} else if util.IsSpace(c) {
|
} else if util.IsSpace(c) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
buf = append(buf, c)
|
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
block.Advance(i)
|
block.Advance(i)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue