diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-05-14 08:12:13 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-05-14 08:12:13 -0700 |
commit | 0e4769d5c1e254fa1747701d2da708d0cb61d0c3 (patch) | |
tree | 4a7b13b50456cc57743a1bedbbb5285605817479 /src/html.c | |
parent | 5ba5740f7e4404c0111a37f77db42c105740a6ff (diff) | |
parent | eada41977a4dc6da389d3bdefe7116ac2b1d75bd (diff) |
Merge pull request #38 from nwellnhof/chunks_for_links
Store link URL and title as cmark_chunk
Diffstat (limited to 'src/html.c')
-rw-r--r-- | src/html.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -261,12 +261,13 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, case CMARK_NODE_LINK: if (entering) { cmark_strbuf_puts(html, "<a href=\""); - if (node->as.link.url) - escape_href(html, node->as.link.url, -1); + escape_href(html, node->as.link.url.data, + node->as.link.url.len); - if (node->as.link.title) { + if (node->as.link.title.len) { cmark_strbuf_puts(html, "\" title=\""); - escape_html(html, node->as.link.title, -1); + escape_html(html, node->as.link.title.data, + node->as.link.title.len); } cmark_strbuf_puts(html, "\">"); @@ -278,15 +279,16 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, case CMARK_NODE_IMAGE: if (entering) { cmark_strbuf_puts(html, "<img src=\""); - if (node->as.link.url) - escape_href(html, node->as.link.url, -1); + escape_href(html, node->as.link.url.data, + node->as.link.url.len); cmark_strbuf_puts(html, "\" alt=\""); state->plain = node; } else { - if (node->as.link.title) { + if (node->as.link.title.len) { cmark_strbuf_puts(html, "\" title=\""); - escape_html(html, node->as.link.title, -1); + escape_html(html, node->as.link.title.data, + node->as.link.title.len); } cmark_strbuf_puts(html, "\" />"); |