summaryrefslogtreecommitdiff
path: root/src/html/html.c
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2014-11-18 16:45:11 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2014-11-18 16:45:11 -0800
commit9370b2cfd9b6382164ab7bde36a59409d32ae498 (patch)
tree5a371e5c14340531753e446a0b84a75bab87ec29 /src/html/html.c
parent47580cbda73fa6ad984dc4690625eb27b54bc563 (diff)
parent1d39b50d8889155de11df40f7e89bec09e0c4681 (diff)
Merge branch 'api_tests' of https://github.com/nwellnhof/CommonMark into nwellnhof-api_tests
Diffstat (limited to 'src/html/html.c')
-rw-r--r--src/html/html.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/html/html.c b/src/html/html.c
index 11db0de..8110f87 100644
--- a/src/html/html.c
+++ b/src/html/html.c
@@ -152,11 +152,11 @@ static void inlines_to_plain_html(strbuf *html, cmark_node* ils)
// Convert an inline list to HTML. Returns 0 on success, and sets result.
static void inlines_to_html(strbuf *html, cmark_node* ils)
{
- cmark_node* children;
+ bool visit_children;
render_stack* rstack = NULL;
while(ils != NULL) {
- children = NULL;
+ visit_children = false;
switch(ils->type) {
case NODE_STRING:
escape_html(html, ils->as.literal.data, ils->as.literal.len);
@@ -193,7 +193,7 @@ static void inlines_to_html(strbuf *html, cmark_node* ils)
}
strbuf_puts(html, "\">");
- children = ils->first_child;
+ visit_children = true;
rstack = push_inline(rstack, ils->next, "</a>");
break;
@@ -215,20 +215,20 @@ static void inlines_to_html(strbuf *html, cmark_node* ils)
case NODE_STRONG:
strbuf_puts(html, "<strong>");
- children = ils->first_child;
+ visit_children = true;
rstack = push_inline(rstack, ils->next, "</strong>");
break;
case NODE_EMPH:
strbuf_puts(html, "<em>");
- children = ils->first_child;
+ visit_children = true;
rstack = push_inline(rstack, ils->next, "</em>");
break;
default:
break;
}
- if (children) {
- ils = children;
+ if (visit_children) {
+ ils = ils->first_child;
} else {
ils = ils->next;
}