summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-12-12 23:00:51 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-12-12 23:20:36 -0800
commitb598b52a4acdc2332be3d34e30237d1b93b7dd03 (patch)
tree090d34e6a07d1cf6753cb297dd3704a14403660b
parent45f8e0a6dbafee22b5e6f5c94eca01b92b0ba0aa (diff)
Removed CMARK_NODE_REFERENCE_DEF from API.
There's no reason to store these empty nodes in the API. The references have already been resolved.
-rw-r--r--api_test/main.c5
-rw-r--r--man/man3/cmark.33
-rw-r--r--src/blocks.c3
-rw-r--r--src/cmark.h4
-rw-r--r--src/html.c3
-rw-r--r--src/node.c2
-rw-r--r--src/print.c4
7 files changed, 5 insertions, 19 deletions
diff --git a/api_test/main.c b/api_test/main.c
index 996ada7..25521d0 100644
--- a/api_test/main.c
+++ b/api_test/main.c
@@ -23,7 +23,6 @@ static const cmark_node_type node_types[] = {
CMARK_NODE_PARAGRAPH,
CMARK_NODE_HEADER,
CMARK_NODE_HRULE,
- CMARK_NODE_REFERENCE_DEF,
CMARK_NODE_TEXT,
CMARK_NODE_SOFTBREAK,
CMARK_NODE_LINEBREAK,
@@ -425,8 +424,7 @@ hierarchy(test_batch_runner *runner)
(1 << CMARK_NODE_HTML) |
(1 << CMARK_NODE_PARAGRAPH) |
(1 << CMARK_NODE_HEADER) |
- (1 << CMARK_NODE_HRULE) |
- (1 << CMARK_NODE_REFERENCE_DEF);
+ (1 << CMARK_NODE_HRULE);
int all_inlines =
(1 << CMARK_NODE_TEXT) |
(1 << CMARK_NODE_SOFTBREAK) |
@@ -447,7 +445,6 @@ hierarchy(test_batch_runner *runner)
test_content(runner, CMARK_NODE_PARAGRAPH, all_inlines);
test_content(runner, CMARK_NODE_HEADER, all_inlines);
test_content(runner, CMARK_NODE_HRULE, 0);
- test_content(runner, CMARK_NODE_REFERENCE_DEF, 0);
test_content(runner, CMARK_NODE_TEXT, 0);
test_content(runner, CMARK_NODE_SOFTBREAK, 0);
test_content(runner, CMARK_NODE_LINEBREAK, 0);
diff --git a/man/man3/cmark.3 b/man/man3/cmark.3
index d2b0cd3..5d04380 100644
--- a/man/man3/cmark.3
+++ b/man/man3/cmark.3
@@ -43,10 +43,9 @@ typedef enum {
CMARK_NODE_PARAGRAPH,
CMARK_NODE_HEADER,
CMARK_NODE_HRULE,
- CMARK_NODE_REFERENCE_DEF,
CMARK_NODE_FIRST_BLOCK = CMARK_NODE_DOCUMENT,
- CMARK_NODE_LAST_BLOCK = CMARK_NODE_REFERENCE_DEF,
+ CMARK_NODE_LAST_BLOCK = CMARK_NODE_HRULE,
/* Inline */
CMARK_NODE_TEXT,
diff --git a/src/blocks.c b/src/blocks.c
index ebef88b..8ca10b9 100644
--- a/src/blocks.c
+++ b/src/blocks.c
@@ -201,7 +201,8 @@ static void finalize(cmark_parser *parser, cmark_node* b, int line_number)
strbuf_drop(&b->string_content, pos);
}
if (is_blank(&b->string_content, 0)) {
- b->type = NODE_REFERENCE_DEF;
+ // remove blank node (former reference def)
+ cmark_node_free(b);
}
break;
diff --git a/src/cmark.h b/src/cmark.h
index d77749c..12d0c01 100644
--- a/src/cmark.h
+++ b/src/cmark.h
@@ -47,10 +47,9 @@ typedef enum {
CMARK_NODE_PARAGRAPH,
CMARK_NODE_HEADER,
CMARK_NODE_HRULE,
- CMARK_NODE_REFERENCE_DEF,
CMARK_NODE_FIRST_BLOCK = CMARK_NODE_DOCUMENT,
- CMARK_NODE_LAST_BLOCK = CMARK_NODE_REFERENCE_DEF,
+ CMARK_NODE_LAST_BLOCK = CMARK_NODE_HRULE,
/* Inline */
CMARK_NODE_TEXT,
@@ -329,7 +328,6 @@ int cmark_walk(cmark_node *root, cmark_node_handler handler, void *state);
#define NODE_PARAGRAPH CMARK_NODE_PARAGRAPH
#define NODE_HEADER CMARK_NODE_HEADER
#define NODE_HRULE CMARK_NODE_HRULE
- #define NODE_REFERENCE_DEF CMARK_NODE_REFERENCE_DEF
#define NODE_TEXT CMARK_NODE_TEXT
#define NODE_SOFTBREAK CMARK_NODE_SOFTBREAK
#define NODE_LINEBREAK CMARK_NODE_LINEBREAK
diff --git a/src/html.c b/src/html.c
index e6ae63e..12d4659 100644
--- a/src/html.c
+++ b/src/html.c
@@ -163,9 +163,6 @@ S_render_node(cmark_node *node, int entering, void *vstate)
strbuf_puts(html, "<hr />\n");
break;
- case CMARK_NODE_REFERENCE_DEF:
- break;
-
case CMARK_NODE_PARAGRAPH:
parent = cmark_node_parent(node);
grandparent = cmark_node_parent(parent);
diff --git a/src/node.c b/src/node.c
index 980229e..38f1913 100644
--- a/src/node.c
+++ b/src/node.c
@@ -102,7 +102,6 @@ S_type_string(cmark_node *node)
case CMARK_NODE_PARAGRAPH: return "PARAGRAPH";
case CMARK_NODE_HEADER: return "HEADER";
case CMARK_NODE_HRULE: return "HRULE";
- case CMARK_NODE_REFERENCE_DEF: return "REFERENCE_DEF";
case CMARK_NODE_TEXT: return "TEXT";
case CMARK_NODE_SOFTBREAK: return "SOFTBREAK";
case CMARK_NODE_LINEBREAK: return "LINEBREAK";
@@ -774,7 +773,6 @@ int S_is_leaf_node(cmark_node *current_node)
case CMARK_NODE_HTML:
case CMARK_NODE_HRULE:
case CMARK_NODE_CODE_BLOCK:
- case CMARK_NODE_REFERENCE_DEF:
case CMARK_NODE_TEXT:
case CMARK_NODE_SOFTBREAK:
case CMARK_NODE_LINEBREAK:
diff --git a/src/print.c b/src/print.c
index d2dfe8c..9384a0b 100644
--- a/src/print.c
+++ b/src/print.c
@@ -88,10 +88,6 @@ static void render_nodes(strbuf* buffer, cmark_node* node, int indent)
print_str(buffer, node->string_content.ptr, -1);
strbuf_putc(buffer, '\n');
break;
- case NODE_REFERENCE_DEF:
- // skip
- // strbuf_printf(buffer, "reference_def\n");
- break;
case NODE_TEXT:
strbuf_printf(buffer, "text ");
print_str(buffer, node->as.literal.data, node->as.literal.len);