MCPcopy Create free account
hub / github.com/MultiMC/Launcher / parse_emph3

Function parse_emph3

libraries/hoedown/src/document.c:677–715  ·  view source on GitHub ↗

parse_emph3 • parsing single emphase */ finds the first closing tag, and delegates to the other emph */

Source from the content-addressed store, hash-verified

675/* parse_emph3 • parsing single emphase */
676/* finds the first closing tag, and delegates to the other emph */
677static size_t
678parse_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 */
718static size_t

Callers 1

char_emphasisFunction · 0.85

Calls 7

find_emph_charFunction · 0.85
_isspaceFunction · 0.85
newbufFunction · 0.85
parse_inlineFunction · 0.85
popbufFunction · 0.85
parse_emph1Function · 0.85
parse_emph2Function · 0.85

Tested by

no test coverage detected