diff options
author | John MacFarlane <[email protected]> | 2014-12-16 12:01:19 -0800 |
---|---|---|
committer | John MacFarlane <[email protected]> | 2014-12-16 12:01:19 -0800 |
commit | 6e25c889cf33a6217a9b4cf37ea1a6361883901b (patch) | |
tree | 949a5482cf2df495107edf03d822fc5a05e1ae31 /src/node.c | |
parent | 06fcdb7592a6106daa52dfe4830373ed735e4053 (diff) |
Added 'literal' field to 'code' struct.
In the last few commits we were using as.code.fenced and as.literal at
the same time for NODE_CODE_BLOCK, which obviously led to problems.
Diffstat (limited to 'src/node.c')
-rw-r--r-- | src/node.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -42,7 +42,7 @@ void S_free_nodes(cmark_node *e) switch (e->type){ case NODE_CODE_BLOCK: cmark_chunk_free(&e->as.code.info); - cmark_chunk_free(&e->as.literal); + cmark_chunk_free(&e->as.code.literal); break; case NODE_TEXT: case NODE_INLINE_HTML: @@ -183,13 +183,15 @@ cmark_node_get_literal(cmark_node *node) { } switch (node->type) { - case NODE_CODE_BLOCK: case NODE_HTML: case NODE_TEXT: case NODE_INLINE_HTML: case NODE_CODE: return cmark_chunk_to_cstr(&node->as.literal); + case NODE_CODE_BLOCK: + return cmark_chunk_to_cstr(&node->as.code.literal); + default: break; } @@ -204,7 +206,6 @@ cmark_node_set_literal(cmark_node *node, const char *content) { } switch (node->type) { - case NODE_CODE_BLOCK: case NODE_HTML: case NODE_TEXT: case NODE_INLINE_HTML: @@ -212,6 +213,10 @@ cmark_node_set_literal(cmark_node *node, const char *content) { cmark_chunk_set_cstr(&node->as.literal, content); return 1; + case NODE_CODE_BLOCK: + cmark_chunk_set_cstr(&node->as.code.literal, content); + return 1; + default: break; } |