1
0
mirror of https://github.com/danog/blackfriday.git synced 2024-11-30 04:29:13 +01:00

Move a couple helpers to parser where they're used

This commit is contained in:
Vytautas Šaltenis 2016-04-11 11:51:16 +03:00
parent 76d8c71d70
commit 3575453f08
2 changed files with 16 additions and 16 deletions

View File

@ -1485,3 +1485,19 @@ func (p *parser) paragraph(data []byte) int {
p.renderParagraph(data[:i]) p.renderParagraph(data[:i])
return i return i
} }
func skipChar(data []byte, start int, char byte) int {
i := start
for i < len(data) && data[i] == char {
i++
}
return i
}
func skipUntilChar(text []byte, start int, char byte) int {
i := start
for i < len(text) && text[i] != char {
i++
}
return i
}

16
html.go
View File

@ -216,14 +216,6 @@ func findHtmlTagPos(tag []byte, tagname string) (bool, int) {
return false, -1 return false, -1
} }
func skipUntilChar(text []byte, start int, char byte) int {
i := start
for i < len(text) && text[i] != char {
i++
}
return i
}
func skipSpace(tag []byte, i int) int { func skipSpace(tag []byte, i int) int {
for i < len(tag) && isspace(tag[i]) { for i < len(tag) && isspace(tag[i]) {
i++ i++
@ -231,14 +223,6 @@ func skipSpace(tag []byte, i int) int {
return i return i
} }
func skipChar(data []byte, start int, char byte) int {
i := start
for i < len(data) && data[i] == char {
i++
}
return i
}
func isRelativeLink(link []byte) (yes bool) { func isRelativeLink(link []byte) (yes bool) {
// a tag begin with '#' // a tag begin with '#'
if link[0] == '#' { if link[0] == '#' {