summaryrefslogtreecommitdiff
path: root/src/html.c
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2015-05-09 15:57:35 +0200
committerNick Wellnhofer <wellnhofer@aevum.de>2015-05-14 14:36:01 +0200
commitda23f80b53d47c76a85ba163cb0fb426050f3738 (patch)
tree6e63fe0cead79a82f8d1ce27ef0b68e7d4114b27 /src/html.c
parentbc5f16f146558a1faf9be6abe034755421f6ecce (diff)
Store link URL and title as cmark_chunk
Diffstat (limited to 'src/html.c')
-rw-r--r--src/html.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/html.c b/src/html.c
index f1b88fa..c15f6f4 100644
--- a/src/html.c
+++ b/src/html.c
@@ -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, "\" />");