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

Function parse_table_row

libraries/hoedown/src/document.c:2195–2250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2193}
2194
2195static void
2196parse_table_row(
2197 hoedown_buffer *ob,
2198 hoedown_document *doc,
2199 uint8_t *data,
2200 size_t size,
2201 size_t columns,
2202 hoedown_table_flags *col_data,
2203 hoedown_table_flags header_flag)
2204{
2205 size_t i = 0, col, len;
2206 hoedown_buffer *row_work = 0;
2207
2208 if (!doc->md.table_cell || !doc->md.table_row)
2209 return;
2210
2211 row_work = newbuf(doc, BUFFER_SPAN);
2212
2213 if (i < size && data[i] == '|')
2214 i++;
2215
2216 for (col = 0; col < columns && i < size; ++col) {
2217 size_t cell_start, cell_end;
2218 hoedown_buffer *cell_work;
2219
2220 cell_work = newbuf(doc, BUFFER_SPAN);
2221
2222 while (i < size && _isspace(data[i]))
2223 i++;
2224
2225 cell_start = i;
2226
2227 len = find_emph_char(data + i, size - i, '|');
2228 i += len ? len : size - i;
2229
2230 cell_end = i - 1;
2231
2232 while (cell_end > cell_start && _isspace(data[cell_end]))
2233 cell_end--;
2234
2235 parse_inline(cell_work, doc, data + cell_start, 1 + cell_end - cell_start);
2236 doc->md.table_cell(row_work, cell_work, col_data[col] | header_flag, &doc->data);
2237
2238 popbuf(doc, BUFFER_SPAN);
2239 i++;
2240 }
2241
2242 for (; col < columns; ++col) {
2243 hoedown_buffer empty_cell = { 0, 0, 0, 0, NULL, NULL, NULL };
2244 doc->md.table_cell(row_work, &empty_cell, col_data[col] | header_flag, &doc->data);
2245 }
2246
2247 doc->md.table_row(ob, row_work, &doc->data);
2248
2249 popbuf(doc, BUFFER_SPAN);
2250}
2251
2252static size_t

Callers 2

parse_table_headerFunction · 0.85
parse_tableFunction · 0.85

Calls 5

newbufFunction · 0.85
_isspaceFunction · 0.85
find_emph_charFunction · 0.85
parse_inlineFunction · 0.85
popbufFunction · 0.85

Tested by

no test coverage detected