parse_emph2 • parsing single emphase */
| 642 | |
| 643 | /* parse_emph2 • parsing single emphase */ |
| 644 | static size_t |
| 645 | parse_emph2(hoedown_buffer *ob, hoedown_document *doc, uint8_t *data, size_t size, uint8_t c) |
| 646 | { |
| 647 | size_t i = 0, len; |
| 648 | hoedown_buffer *work = 0; |
| 649 | int r; |
| 650 | |
| 651 | while (i < size) { |
| 652 | len = find_emph_char(data + i, size - i, c); |
| 653 | if (!len) return 0; |
| 654 | i += len; |
| 655 | |
| 656 | if (i + 1 < size && data[i] == c && data[i + 1] == c && i && !_isspace(data[i - 1])) { |
| 657 | work = newbuf(doc, BUFFER_SPAN); |
| 658 | parse_inline(work, doc, data, i); |
| 659 | |
| 660 | if (c == '~') |
| 661 | r = doc->md.strikethrough(ob, work, &doc->data); |
| 662 | else if (c == '=') |
| 663 | r = doc->md.highlight(ob, work, &doc->data); |
| 664 | else |
| 665 | r = doc->md.double_emphasis(ob, work, &doc->data); |
| 666 | |
| 667 | popbuf(doc, BUFFER_SPAN); |
| 668 | return r ? i + 2 : 0; |
| 669 | } |
| 670 | i++; |
| 671 | } |
| 672 | return 0; |
| 673 | } |
| 674 | |
| 675 | /* parse_emph3 • parsing single emphase */ |
| 676 | /* finds the first closing tag, and delegates to the other emph */ |
no test coverage detected