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

Function parse_table

libraries/hoedown/src/document.c:2344–2409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2342}
2343
2344static size_t
2345parse_table(
2346 hoedown_buffer *ob,
2347 hoedown_document *doc,
2348 uint8_t *data,
2349 size_t size)
2350{
2351 size_t i;
2352
2353 hoedown_buffer *work = 0;
2354 hoedown_buffer *header_work = 0;
2355 hoedown_buffer *body_work = 0;
2356
2357 size_t columns;
2358 hoedown_table_flags *col_data = NULL;
2359
2360 work = newbuf(doc, BUFFER_BLOCK);
2361 header_work = newbuf(doc, BUFFER_SPAN);
2362 body_work = newbuf(doc, BUFFER_BLOCK);
2363
2364 i = parse_table_header(header_work, doc, data, size, &columns, &col_data);
2365 if (i > 0) {
2366
2367 while (i < size) {
2368 size_t row_start;
2369 int pipes = 0;
2370
2371 row_start = i;
2372
2373 while (i < size && data[i] != '\n')
2374 if (data[i++] == '|')
2375 pipes++;
2376
2377 if (pipes == 0 || i == size) {
2378 i = row_start;
2379 break;
2380 }
2381
2382 parse_table_row(
2383 body_work,
2384 doc,
2385 data + row_start,
2386 i - row_start,
2387 columns,
2388 col_data, 0
2389 );
2390
2391 i++;
2392 }
2393
2394 if (doc->md.table_header)
2395 doc->md.table_header(work, header_work, &doc->data);
2396
2397 if (doc->md.table_body)
2398 doc->md.table_body(work, body_work, &doc->data);
2399
2400 if (doc->md.table)
2401 doc->md.table(ob, work, &doc->data);

Callers 1

parse_blockFunction · 0.85

Calls 5

newbufFunction · 0.85
parse_table_headerFunction · 0.85
parse_table_rowFunction · 0.85
popbufFunction · 0.85
tableMethod · 0.80

Tested by

no test coverage detected