From e9e4fa11de887c3e558310d3ef3bc6215510f6f4 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 14 Dec 2014 14:03:08 -0800 Subject: Use chunk for fenced code info, instead of strbuf. --- src/html.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/html.c') diff --git a/src/html.c b/src/html.c index 23812df..34552bf 100644 --- a/src/html.c +++ b/src/html.c @@ -47,7 +47,6 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, void *vstate) strbuf *html = state->html; char start_header[] = ""; char end_header[] = ""; - strbuf *info; bool tight; bool entering = (ev_type == CMARK_EVENT_ENTER); @@ -136,20 +135,21 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, void *vstate) break; case CMARK_NODE_CODE_BLOCK: - info = &node->as.code.info; cr(html); if (&node->as.code.fence_length == 0 - || strbuf_len(info) == 0) { + || node->as.code.info.len == 0) { strbuf_puts(html, "
");
 		}
 		else {
-			int first_tag = strbuf_strchr(info, ' ', 0);
-			if (first_tag < 0)
-				first_tag = strbuf_len(info);
+			int first_tag = 0;
+			while (first_tag < node->as.code.info.len &&
+			       node->as.code.info.data[first_tag] != ' ') {
+				first_tag += 1;
+			}
 
 			strbuf_puts(html, "
ptr, first_tag);
+			escape_html(html, node->as.code.info.data, first_tag);
 			strbuf_puts(html, "\">");
 		}
 
-- 
cgit v1.2.3