summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--man/man3/cmark.32
-rw-r--r--src/blocks.c2
-rw-r--r--src/html.c3
-rw-r--r--src/man.c4
-rw-r--r--src/node.c11
-rw-r--r--src/node.h1
-rw-r--r--src/print.c4
7 files changed, 17 insertions, 10 deletions
diff --git a/man/man3/cmark.3 b/man/man3/cmark.3
index 6a16e35..f371139 100644
--- a/man/man3/cmark.3
+++ b/man/man3/cmark.3
@@ -1,4 +1,4 @@
-.TH cmark 3 "December 15, 2014" "LOCAL" "Library Functions Manual"
+.TH cmark 3 "December 16, 2014" "LOCAL" "Library Functions Manual"
.SH
NAME
.PP
diff --git a/src/blocks.c b/src/blocks.c
index fe43055..4dcd3f4 100644
--- a/src/blocks.c
+++ b/src/blocks.c
@@ -232,7 +232,7 @@ finalize(cmark_parser *parser, cmark_node* b, int line_number)
cmark_strbuf_drop(&b->string_content, firstlinelen + 1);
}
- b->as.literal = cmark_chunk_buf_detach(&b->string_content);
+ b->as.code.literal = cmark_chunk_buf_detach(&b->string_content);
break;
case NODE_HTML:
diff --git a/src/html.c b/src/html.c
index b5a0950..40b5e94 100644
--- a/src/html.c
+++ b/src/html.c
@@ -152,7 +152,8 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, void *vstate)
cmark_strbuf_puts(html, "\">");
}
- escape_html(html, node->as.literal.data, node->as.literal.len);
+ escape_html(html, node->as.code.literal.data,
+ node->as.code.literal.len);
cmark_strbuf_puts(html, "</code></pre>\n");
break;
diff --git a/src/man.c b/src/man.c
index e72a121..36a5c99 100644
--- a/src/man.c
+++ b/src/man.c
@@ -130,8 +130,8 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, void *vstate)
case CMARK_NODE_CODE_BLOCK:
cr(man);
cmark_strbuf_puts(man, ".IP\n.nf\n\\f[C]\n");
- escape_man(man, node->as.literal.data,
- node->as.literal.len);
+ escape_man(man, node->as.code.literal.data,
+ node->as.code.literal.len);
cr(man);
cmark_strbuf_puts(man, "\\f[]\n.fi");
cr(man);
diff --git a/src/node.c b/src/node.c
index 8e74204..1ae5e57 100644
--- a/src/node.c
+++ b/src/node.c
@@ -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;
}
diff --git a/src/node.h b/src/node.h
index 199f020..fb3b667 100644
--- a/src/node.h
+++ b/src/node.h
@@ -27,6 +27,7 @@ typedef struct {
int fence_offset;
unsigned char fence_char;
cmark_chunk info;
+ cmark_chunk literal;
} cmark_code;
typedef struct {
diff --git a/src/print.c b/src/print.c
index a4654f2..c38271f 100644
--- a/src/print.c
+++ b/src/print.c
@@ -81,8 +81,8 @@ static void render_nodes(cmark_strbuf* buffer, cmark_node* node, int indent)
print_str(buffer, node->as.code.info.data,
node->as.code.info.len);
cmark_strbuf_putc(buffer, ' ');
- print_str(buffer, node->as.literal.data,
- node->as.literal.len);
+ print_str(buffer, node->as.code.literal.data,
+ node->as.code.literal.len);
cmark_strbuf_putc(buffer, '\n');
break;
case NODE_HTML: