Branch Coverage

hoedown/src/html.c
Criterion Covered Total %
branch 41 286 14.3


line true false branch
34 0 0 if (tag_size < 3 || tag_data[0] != '<')
0 0 if (tag_size < 3 || tag_data[0] != '<')
39 0 0 if (tag_data[i] == '/') {
44 0 0 for (; i < tag_size; ++i, ++tagname) {
45 0 0 if (*tagname == 0)
48 0 0 if (tag_data[i] != *tagname)
52 0 0 if (i == tag_size)
55 0 0 if (isspace(tag_data[i]) || tag_data[i] == '>')
0 0 if (isspace(tag_data[i]) || tag_data[i] == '>')
56 0 0 return closed ? HOEDOWN_HTML_TAG_CLOSE : HOEDOWN_HTML_TAG_OPEN;
79 1 0 if (!link || !link->size)
1 0 if (!link || !link->size)
83 0 0 !hoedown_autolink_is_safe(link->data, link->size) &&
88 0 1 if (type == HOEDOWN_AUTOLINK_EMAIL)
92 0 1 if (state->link_attributes) {
105 0 1 if (hoedown_buffer_prefix(link, "mailto:") == 0) {
121 0 0 if (ob->size) hoedown_buffer_putc(ob, '\n');
123 0 0 if (lang && lang->size) {
0 0 if (lang && lang->size) {
125 0 0 if (state->flags & HOEDOWN_HTML_PRETTIFY) {
132 0 0 for (i = 0; i < lang->size; ++i, ++cls) {
133 0 0 while (i < lang->size && isspace(lang->data[i]))
0 0 while (i < lang->size && isspace(lang->data[i]))
136 0 0 if (i < lang->size) {
138 0 0 while (i < lang->size && !isspace(lang->data[i]))
0 0 while (i < lang->size && !isspace(lang->data[i]))
141 0 0 if (lang->data[org] == '.')
144 0 0 if (cls) hoedown_buffer_putc(ob, ' ');
150 0 0 } else if (state->flags & HOEDOWN_HTML_PRETTIFY) {
156 0 0 if (text)
165 0 0 if (ob->size) hoedown_buffer_putc(ob, '\n');
167 0 0 if (text) hoedown_buffer_put(ob, text->data, text->size);
175 0 0 if (state->flags & HOEDOWN_HTML_PRETTIFY)
179 0 0 if (text) escape_html(ob, text->data, text->size);
187 0 0 if (!text || !text->size)
0 0 if (!text || !text->size)
199 0 0 if (!text || !text->size)
0 0 if (!text || !text->size)
212 0 0 if (!text || !text->size) return 0;
0 0 if (!text || !text->size) return 0;
214 0 0 if (text) hoedown_buffer_put(ob, text->data, text->size);
222 0 0 if (!text || !text->size)
0 0 if (!text || !text->size)
235 0 0 if (!text || !text->size)
0 0 if (!text || !text->size)
248 0 0 if (!text || !text->size)
0 0 if (!text || !text->size)
262 0 0 hoedown_buffer_puts(ob, USE_XHTML(state) ? "<br/>\n" : "<br>\n");
0 0 hoedown_buffer_puts(ob, USE_XHTML(state) ? "<br/>\n" : "<br>\n");
271 6 3 if (ob->size)
274 9 0 if ((state->flags & HOEDOWN_HTML_TOC) && (level <= state->toc_data.nesting_level))
9 0 if ((state->flags & HOEDOWN_HTML_TOC) && (level <= state->toc_data.nesting_level))
279 9 0 if (text) hoedown_buffer_put(ob, text->data, text->size);
288 0 0 if (link != NULL && (state->flags & HOEDOWN_HTML_SAFELINK) != 0 && !hoedown_autolink_is_safe(link->data, link->size))
0 0 if (link != NULL && (state->flags & HOEDOWN_HTML_SAFELINK) != 0 && !hoedown_autolink_is_safe(link->data, link->size))
0 0 if (link != NULL && (state->flags & HOEDOWN_HTML_SAFELINK) != 0 && !hoedown_autolink_is_safe(link->data, link->size))
293 0 0 if (link && link->size)
0 0 if (link && link->size)
296 0 0 if (title && title->size) {
0 0 if (title && title->size) {
301 0 0 if (state->link_attributes) {
309 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);
317 0 0 if (ob->size) hoedown_buffer_putc(ob, '\n');
318 0 0 hoedown_buffer_put(ob, flags & HOEDOWN_LIST_ORDERED ? "<ol>\n" : "<ul>\n", 5);
319 0 0 if (text) hoedown_buffer_put(ob, text->data, text->size);
320 0 0 hoedown_buffer_put(ob, flags & HOEDOWN_LIST_ORDERED ? "</ol>\n" : "</ul>\n", 6);
327 0 0 if (text) {
329 0 0 while (size && text->data[size - 1] == '\n')
0 0 while (size && text->data[size - 1] == '\n')
343 0 1 if (ob->size) hoedown_buffer_putc(ob, '\n');
345 1 0 if (!text || !text->size)
1 0 if (!text || !text->size)
348 1 0 while (i < text->size && isspace(text->data[i])) i++;
0 1 while (i < text->size && isspace(text->data[i])) i++;
350 1 0 if (i == text->size)
354 0 1 if (state->flags & HOEDOWN_HTML_HARD_WRAP) {
356 0 0 while (i < text->size) {
358 0 0 while (i < text->size && text->data[i] != '\n')
0 0 while (i < text->size && text->data[i] != '\n')
361 0 0 if (i > org)
368 0 0 if (i >= text->size - 1)
384 0 0 if (!text) return;
386 0 0 while (sz > 0 && text->data[sz - 1] == '\n') sz--;
0 0 while (sz > 0 && text->data[sz - 1] == '\n') sz--;
388 0 0 while (org < sz && text->data[org] == '\n') org++;
0 0 while (org < sz && text->data[org] == '\n') org++;
389 0 0 if (org >= sz) return;
390 0 0 if (ob->size) hoedown_buffer_putc(ob, '\n');
398 0 0 if (!text || !text->size) return 0;
0 0 if (!text || !text->size) return 0;
409 0 0 if (ob->size) hoedown_buffer_putc(ob, '\n');
410 0 0 hoedown_buffer_puts(ob, USE_XHTML(state) ? "<hr/>\n" : "<hr>\n");
417 0 0 if (!link || !link->size) return 0;
0 0 if (!link || !link->size) return 0;
423 0 0 if (alt && alt->size)
0 0 if (alt && alt->size)
426 0 0 if (title && title->size) {
0 0 if (title && title->size) {
430 0 0 hoedown_buffer_puts(ob, USE_XHTML(state) ? "\"/>" : "\">");
441 0 0 if((state->flags & HOEDOWN_HTML_ESCAPE) != 0) {
446 0 0 if ((state->flags & HOEDOWN_HTML_SKIP_HTML) != 0)
468 0 0 if (ob->size) hoedown_buffer_putc(ob, '\n');
470 0 0 if (header)
473 0 0 if (body)
482 0 0 if (text)
490 0 0 if (flags & HOEDOWN_TABLE_HEADER) {
513 0 0 if (text)
516 0 0 if (flags & HOEDOWN_TABLE_HEADER) {
526 0 0 if (!text || !text->size) return 0;
0 0 if (!text || !text->size) return 0;
536 10 0 if (text)
545 0 0 if (ob->size) hoedown_buffer_putc(ob, '\n');
547 0 0 hoedown_buffer_puts(ob, USE_XHTML(state) ? "<hr/>\n" : "<hr>\n");
550 0 0 if (text)
563 0 0 if (text) {
564 0 0 while ((i+3) < text->size) {
565 0 0 if (text->data[i++] != '<') continue;
566 0 0 if (text->data[i++] != '/') continue;
567 0 0 if (text->data[i++] != 'p' && text->data[i] != 'P') continue;
0 0 if (text->data[i++] != 'p' && text->data[i] != 'P') continue;
568 0 0 if (text->data[i] != '>') continue;
576 0 0 if (pfound) {
580 0 0 } else if (text) {
598 7 0 if (level <= state->toc_data.nesting_level) {
601 1 6 if (state->toc_data.current_level == 0)
606 5 2 if (level > state->toc_data.current_level) {
607 5 5 while (level > state->toc_data.current_level) {
611 2 0 } else if (level < state->toc_data.current_level) {
613 3 2 while (level < state->toc_data.current_level) {
623 7 0 if (text) escape_html(ob, text->data, text->size);
631 0 0 if (content && content->size)
0 0 if (content && content->size)
641 2 1 while (state->toc_data.current_level > 0) {
695 1 0 if (!state)
700 1 0 if (nesting_level > 0) {
707 0 1 if (!renderer) {
766 5 0 if (!state)
773 4 1 if (nesting_level > 0) {
780 0 5 if (!renderer) {
787 0 5 if (render_flags & HOEDOWN_HTML_SKIP_IMAGES)
790 0 5 if (render_flags & HOEDOWN_HTML_SKIP_LINKS) {
795 0 5 if (render_flags & HOEDOWN_HTML_SKIP_HTML || render_flags & HOEDOWN_HTML_ESCAPE)