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

Function parse_blockcode

libraries/hoedown/src/document.c:1756–1795  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1754}
1755
1756static size_t
1757parse_blockcode(hoedown_buffer *ob, hoedown_document *doc, uint8_t *data, size_t size)
1758{
1759 size_t beg, end, pre;
1760 hoedown_buffer *work = 0;
1761
1762 work = newbuf(doc, BUFFER_BLOCK);
1763
1764 beg = 0;
1765 while (beg < size) {
1766 for (end = beg + 1; end < size && data[end - 1] != '\n'; end++) {};
1767 pre = prefix_code(data + beg, end - beg);
1768
1769 if (pre)
1770 beg += pre; /* skipping prefix */
1771 else if (!is_empty(data + beg, end - beg))
1772 /* non-empty non-prefixed line breaks the pre */
1773 break;
1774
1775 if (beg < end) {
1776 /* verbatim copy to the working buffer,
1777 escaping entities */
1778 if (is_empty(data + beg, end - beg))
1779 hoedown_buffer_putc(work, '\n');
1780 else hoedown_buffer_put(work, data + beg, end - beg);
1781 }
1782 beg = end;
1783 }
1784
1785 while (work->size && work->data[work->size - 1] == '\n')
1786 work->size -= 1;
1787
1788 hoedown_buffer_putc(work, '\n');
1789
1790 if (doc->md.blockcode)
1791 doc->md.blockcode(ob, work, NULL, &doc->data);
1792
1793 popbuf(doc, BUFFER_BLOCK);
1794 return beg;
1795}
1796
1797/* parse_listitem • parsing of a single list item */
1798/* assuming initial prefix is already removed */

Callers 1

parse_blockFunction · 0.85

Calls 6

newbufFunction · 0.85
prefix_codeFunction · 0.85
is_emptyFunction · 0.85
hoedown_buffer_putcFunction · 0.85
hoedown_buffer_putFunction · 0.85
popbufFunction · 0.85

Tested by

no test coverage detected