diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2015-05-09 15:57:35 +0200 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2015-05-14 14:36:01 +0200 |
commit | da23f80b53d47c76a85ba163cb0fb426050f3738 (patch) | |
tree | 6e63fe0cead79a82f8d1ce27ef0b68e7d4114b27 /src/html.c | |
parent | bc5f16f146558a1faf9be6abe034755421f6ecce (diff) |
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, "\" />"); |