diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-12-14 14:03:08 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-12-14 14:03:57 -0800 |
commit | e9e4fa11de887c3e558310d3ef3bc6215510f6f4 (patch) | |
tree | f96b463213727d0f477a82eae73066ac1fff43ef /src/blocks.c | |
parent | 37554bbb7901b7116e1a5006f331968444141b76 (diff) |
Use chunk for fenced code info, instead of strbuf.
Diffstat (limited to 'src/blocks.c')
-rw-r--r-- | src/blocks.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/blocks.c b/src/blocks.c index 18a6536..d770c3d 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -220,16 +220,17 @@ finalize(cmark_parser *parser, cmark_node* b, int line_number) // first line of contents becomes info firstlinelen = strbuf_strchr(&b->string_content, '\n', 0); + strbuf tmp = GH_BUF_INIT; houdini_unescape_html_f( - &b->as.code.info, - b->string_content.ptr, - firstlinelen - ); + &tmp, + b->string_content.ptr, + firstlinelen + ); + strbuf_trim(&tmp); + strbuf_unescape(&tmp); + b->as.code.info = chunk_buf_detach(&tmp); strbuf_drop(&b->string_content, firstlinelen + 1); - - strbuf_trim(&b->as.code.info); - strbuf_unescape(&b->as.code.info); } b->as.literal = chunk_buf_detach(&b->string_content); break; @@ -671,7 +672,7 @@ S_process_line(cmark_parser *parser, const unsigned char *buffer, size_t bytes) container->as.code.fence_char = 0; container->as.code.fence_length = 0; container->as.code.fence_offset = 0; - strbuf_init(&container->as.code.info, 0); + container->as.code.info = chunk_literal(""); } else { // indent > 4 in lazy line break; } @@ -706,7 +707,7 @@ S_process_line(cmark_parser *parser, const unsigned char *buffer, size_t bytes) container->as.code.fence_char = peek_at(&input, first_nonspace); container->as.code.fence_length = matched; container->as.code.fence_offset = first_nonspace - offset; - strbuf_init(&container->as.code.info, 0); + container->as.code.info = chunk_literal(""); offset = first_nonspace + matched; } else if ((matched = scan_html_block_tag(&input, first_nonspace))) { |