parse_emph3 • parsing single emphase */ finds the first closing tag, and delegates to the other emph */
| 675 | /* parse_emph3 • parsing single emphase */ |
| 676 | /* finds the first closing tag, and delegates to the other emph */ |
| 677 | static size_t |
| 678 | parse_emph3(hoedown_buffer *ob, hoedown_document *doc, uint8_t *data, size_t size, uint8_t c) |
| 679 | { |
| 680 | size_t i = 0, len; |
| 681 | int r; |
| 682 | |
| 683 | while (i < size) { |
| 684 | len = find_emph_char(data + i, size - i, c); |
| 685 | if (!len) return 0; |
| 686 | i += len; |
| 687 | |
| 688 | /* skip spacing preceded symbols */ |
| 689 | if (data[i] != c || _isspace(data[i - 1])) |
| 690 | continue; |
| 691 | |
| 692 | if (i + 2 < size && data[i + 1] == c && data[i + 2] == c && doc->md.triple_emphasis) { |
| 693 | /* triple symbol found */ |
| 694 | hoedown_buffer *work = newbuf(doc, BUFFER_SPAN); |
| 695 | |
| 696 | parse_inline(work, doc, data, i); |
| 697 | r = doc->md.triple_emphasis(ob, work, &doc->data); |
| 698 | popbuf(doc, BUFFER_SPAN); |
| 699 | return r ? i + 3 : 0; |
| 700 | |
| 701 | } else if (i + 1 < size && data[i + 1] == c) { |
| 702 | /* double symbol found, handing over to emph1 */ |
| 703 | len = parse_emph1(ob, doc, data - 2, size + 2, c); |
| 704 | if (!len) return 0; |
| 705 | else return len - 2; |
| 706 | |
| 707 | } else { |
| 708 | /* single symbol found, handing over to emph2 */ |
| 709 | len = parse_emph2(ob, doc, data - 1, size + 1, c); |
| 710 | if (!len) return 0; |
| 711 | else return len - 1; |
| 712 | } |
| 713 | } |
| 714 | return 0; |
| 715 | } |
| 716 | |
| 717 | /* parse_math • parses a math span until the given ending delimiter */ |
| 718 | static size_t |
no test coverage detected