MCPcopy
hub / github.com/russross/blackfriday / findHTMLTagPos

Function findHTMLTagPos

html.go:179–213  ·  view source on GitHub ↗
(tag []byte, tagname string)

Source from the content-addressed store, hash-verified

177}
178
179func findHTMLTagPos(tag []byte, tagname string) (bool, int) {
180 i := 0
181 if i < len(tag) && tag[0] != '<' {
182 return false, -1
183 }
184 i++
185 i = skipSpace(tag, i)
186
187 if i < len(tag) && tag[i] == '/' {
188 i++
189 }
190
191 i = skipSpace(tag, i)
192 j := 0
193 for ; i < len(tag); i, j = i+1, j+1 {
194 if j >= len(tagname) {
195 break
196 }
197
198 if strings.ToLower(string(tag[i]))[0] != tagname[j] {
199 return false, -1
200 }
201 }
202
203 if i == len(tag) {
204 return false, -1
205 }
206
207 rightAngle := skipUntilCharIgnoreQuotes(tag, i, '>')
208 if rightAngle >= i {
209 return true, rightAngle
210 }
211
212 return false, -1
213}
214
215func skipSpace(tag []byte, i int) int {
216 for i < len(tag) && isspace(tag[i]) {

Callers 1

isHTMLTagFunction · 0.85

Calls 2

skipSpaceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…