hoedown/src/html.c | |||
---|---|---|---|
Criterion | Covered | Total | % |
branch | 33 | 242 | 13.6 |
line | true | false | branch |
---|---|---|---|
18 | 0 | 0 | if (size < 3 || data[0] != '<') |
0 | 0 | if (size < 3 || data[0] != '<') | |
23 | 0 | 0 | if (data[i] == '/') { |
28 | 0 | 0 | for (; i < size; ++i, ++tagname) { |
29 | 0 | 0 | if (*tagname == 0) |
32 | 0 | 0 | if (data[i] != *tagname) |
36 | 0 | 0 | if (i == size) |
39 | 0 | 0 | if (isspace(data[i]) || data[i] == '>') |
0 | 0 | if (isspace(data[i]) || data[i] == '>') | |
40 | 0 | 0 | return closed ? HOEDOWN_HTML_TAG_CLOSE : HOEDOWN_HTML_TAG_OPEN; |
63 | 1 | 0 | if (!link || !link->size) |
1 | 0 | if (!link || !link->size) | |
67 | 0 | 1 | if (type == HOEDOWN_AUTOLINK_EMAIL) |
71 | 0 | 1 | if (state->link_attributes) { |
84 | 0 | 1 | if (hoedown_buffer_prefix(link, "mailto:") == 0) { |
98 | 0 | 0 | if (ob->size) hoedown_buffer_putc(ob, '\n'); |
100 | 0 | 0 | if (lang) { |
108 | 0 | 0 | if (text) |
117 | 0 | 0 | if (ob->size) hoedown_buffer_putc(ob, '\n'); |
119 | 0 | 0 | if (content) hoedown_buffer_put(ob, content->data, content->size); |
127 | 0 | 0 | if (text) escape_html(ob, text->data, text->size); |
135 | 0 | 0 | if (!content || !content->size) |
0 | 0 | if (!content || !content->size) | |
147 | 0 | 0 | if (!content || !content->size) |
0 | 0 | if (!content || !content->size) | |
160 | 0 | 0 | if (!content || !content->size) return 0; |
0 | 0 | if (!content || !content->size) return 0; | |
162 | 0 | 0 | if (content) hoedown_buffer_put(ob, content->data, content->size); |
170 | 0 | 0 | if (!content || !content->size) |
0 | 0 | if (!content || !content->size) | |
183 | 0 | 0 | if (!content || !content->size) |
0 | 0 | if (!content || !content->size) | |
196 | 0 | 0 | if (!content || !content->size) |
0 | 0 | if (!content || !content->size) | |
210 | 0 | 0 | hoedown_buffer_puts(ob, USE_XHTML(state) ? " \n" : " \n"); |
0 | 0 | hoedown_buffer_puts(ob, USE_XHTML(state) ? " \n" : " \n"); |
|
219 | 12 | 4 | if (ob->size) |
222 | 9 | 7 | if (level <= state->toc_data.nesting_level) |
227 | 16 | 0 | if (content) hoedown_buffer_put(ob, content->data, content->size); |
238 | 0 | 0 | if (link && link->size) |
0 | 0 | if (link && link->size) | |
241 | 0 | 0 | if (title && title->size) { |
0 | 0 | if (title && title->size) { | |
246 | 0 | 0 | if (state->link_attributes) { |
254 | 0 | 0 | if (content && content->size) hoedown_buffer_put(ob, content->data, content->size); |
0 | 0 | if (content && content->size) hoedown_buffer_put(ob, content->data, content->size); | |
262 | 0 | 0 | if (ob->size) hoedown_buffer_putc(ob, '\n'); |
263 | 0 | 0 | hoedown_buffer_put(ob, (const uint8_t *)(flags & HOEDOWN_LIST_ORDERED ? "
|
264 | 0 | 0 | if (content) hoedown_buffer_put(ob, content->data, content->size); |
265 | 0 | 0 | hoedown_buffer_put(ob, (const uint8_t *)(flags & HOEDOWN_LIST_ORDERED ? "\n" : "\n"), 6); |
272 | 0 | 0 | if (content) { |
274 | 0 | 0 | while (size && content->data[size - 1] == '\n') |
0 | 0 | while (size && content->data[size - 1] == '\n') | |
288 | 0 | 1 | if (ob->size) hoedown_buffer_putc(ob, '\n'); |
290 | 1 | 0 | if (!content || !content->size) |
1 | 0 | if (!content || !content->size) | |
293 | 1 | 0 | while (i < content->size && isspace(content->data[i])) i++; |
0 | 1 | while (i < content->size && isspace(content->data[i])) i++; | |
295 | 1 | 0 | if (i == content->size) |
299 | 0 | 1 | if (state->flags & HOEDOWN_HTML_HARD_WRAP) { |
301 | 0 | 0 | while (i < content->size) { |
303 | 0 | 0 | while (i < content->size && content->data[i] != '\n') |
0 | 0 | while (i < content->size && content->data[i] != '\n') | |
306 | 0 | 0 | if (i > org) |
313 | 0 | 0 | if (i >= content->size - 1) |
330 | 0 | 0 | if (!text) |
335 | 0 | 0 | while (sz > 0 && text->data[sz - 1] == '\n') |
0 | 0 | while (sz > 0 && text->data[sz - 1] == '\n') | |
339 | 0 | 0 | while (org < sz && text->data[org] == '\n') |
0 | 0 | while (org < sz && text->data[org] == '\n') | |
342 | 0 | 0 | if (org >= sz) |
345 | 0 | 0 | if (ob->size) |
355 | 0 | 0 | if (!content || !content->size) return 0; |
0 | 0 | if (!content || !content->size) return 0; | |
366 | 0 | 0 | if (ob->size) hoedown_buffer_putc(ob, '\n'); |
367 | 0 | 0 | hoedown_buffer_puts(ob, USE_XHTML(state) ? " \n" : " \n"); |
374 | 0 | 0 | if (!link || !link->size) return 0; |
0 | 0 | if (!link || !link->size) return 0; | |
380 | 0 | 0 | if (alt && alt->size) |
0 | 0 | if (alt && alt->size) | |
383 | 0 | 0 | if (title && title->size) { |
0 | 0 | if (title && title->size) { | |
387 | 0 | 0 | hoedown_buffer_puts(ob, USE_XHTML(state) ? "\"/>" : "\">"); |
398 | 0 | 0 | if((state->flags & HOEDOWN_HTML_ESCAPE) != 0) { |
403 | 0 | 0 | if ((state->flags & HOEDOWN_HTML_SKIP_HTML) != 0) |
413 | 0 | 0 | if (ob->size) hoedown_buffer_putc(ob, '\n'); |
422 | 0 | 0 | if (ob->size) hoedown_buffer_putc(ob, '\n'); |
431 | 0 | 0 | if (ob->size) hoedown_buffer_putc(ob, '\n'); |
441 | 0 | 0 | if (content) hoedown_buffer_put(ob, content->data, content->size); |
448 | 0 | 0 | if (flags & HOEDOWN_TABLE_HEADER) { |
471 | 0 | 0 | if (content) |
474 | 0 | 0 | if (flags & HOEDOWN_TABLE_HEADER) { |
484 | 0 | 0 | if (!content || !content->size) return 0; |
0 | 0 | if (!content || !content->size) return 0; | |
494 | 24 | 0 | if (content) |
503 | 0 | 0 | if (ob->size) hoedown_buffer_putc(ob, '\n'); |
505 | 0 | 0 | hoedown_buffer_puts(ob, USE_XHTML(state) ? " \n" : " \n"); |
508 | 0 | 0 | if (content) hoedown_buffer_put(ob, content->data, content->size); |
520 | 0 | 0 | if (content) { |
521 | 0 | 0 | while ((i+3) < content->size) { |
522 | 0 | 0 | if (content->data[i++] != '<') continue; |
523 | 0 | 0 | if (content->data[i++] != '/') continue; |
524 | 0 | 0 | if (content->data[i++] != 'p' && content->data[i] != 'P') continue; |
0 | 0 | if (content->data[i++] != 'p' && content->data[i] != 'P') continue; | |
525 | 0 | 0 | if (content->data[i] != '>') continue; |
533 | 0 | 0 | if (pfound) { |
537 | 0 | 0 | } else if (content) { |
553 | 0 | 0 | hoedown_buffer_put(ob, (const uint8_t *)(displaymode ? "\\[" : "\\("), 2); |
555 | 0 | 0 | hoedown_buffer_put(ob, (const uint8_t *)(displaymode ? "\\]" : "\\)"), 2); |
564 | 7 | 0 | if (level <= state->toc_data.nesting_level) { |
567 | 1 | 6 | if (state->toc_data.current_level == 0) |
572 | 5 | 2 | if (level > state->toc_data.current_level) { |
573 | 5 | 5 | while (level > state->toc_data.current_level) { |
577 | 2 | 0 | } else if (level < state->toc_data.current_level) { |
579 | 3 | 2 | while (level < state->toc_data.current_level) { |
589 | 7 | 0 | if (content) hoedown_buffer_put(ob, content->data, content->size); |
597 | 0 | 0 | if (content && content->size) hoedown_buffer_put(ob, content->data, content->size); |
0 | 0 | if (content && content->size) hoedown_buffer_put(ob, content->data, content->size); | |
606 | 1 | 0 | if (inline_render) |
611 | 2 | 1 | while (state->toc_data.current_level > 0) { |
742 | 0 | 6 | if (render_flags & HOEDOWN_HTML_SKIP_HTML || render_flags & HOEDOWN_HTML_ESCAPE) |