(data []byte, doRender bool)
| 316 | } |
| 317 | |
| 318 | func (p *Markdown) html(data []byte, doRender bool) int { |
| 319 | var i, j int |
| 320 | |
| 321 | // identify the opening tag |
| 322 | if data[0] != '<' { |
| 323 | return 0 |
| 324 | } |
| 325 | curtag, tagfound := p.htmlFindTag(data[1:]) |
| 326 | |
| 327 | // handle special cases |
| 328 | if !tagfound { |
| 329 | // check for an HTML comment |
| 330 | if size := p.htmlComment(data, doRender); size > 0 { |
| 331 | return size |
| 332 | } |
| 333 | |
| 334 | // check for an <hr> tag |
| 335 | if size := p.htmlHr(data, doRender); size > 0 { |
| 336 | return size |
| 337 | } |
| 338 | |
| 339 | // no special case recognized |
| 340 | return 0 |
| 341 | } |
| 342 | |
| 343 | // look for an unindented matching closing tag |
| 344 | // followed by a blank line |
| 345 | found := false |
| 346 | /* |
| 347 | closetag := []byte("\n</" + curtag + ">") |
| 348 | j = len(curtag) + 1 |
| 349 | for !found { |
| 350 | // scan for a closing tag at the beginning of a line |
| 351 | if skip := bytes.Index(data[j:], closetag); skip >= 0 { |
| 352 | j += skip + len(closetag) |
| 353 | } else { |
| 354 | break |
| 355 | } |
| 356 | |
| 357 | // see if it is the only thing on the line |
| 358 | if skip := p.isEmpty(data[j:]); skip > 0 { |
| 359 | // see if it is followed by a blank line/eof |
| 360 | j += skip |
| 361 | if j >= len(data) { |
| 362 | found = true |
| 363 | i = j |
| 364 | } else { |
| 365 | if skip := p.isEmpty(data[j:]); skip > 0 { |
| 366 | j += skip |
| 367 | found = true |
| 368 | i = j |
| 369 | } |
| 370 | } |
| 371 | } |
| 372 | } |
| 373 | */ |
| 374 | |
| 375 | // if not found, try a second pass looking for indented match |
no test coverage detected