cmark

My personal build of CMark ✏️

Commit
6e599f2ceb8ca1aee0cdb47d37aba16ac5938641
Parent
6db3cb40add3800246bee8cd051baf4243e8ae44
Author
John MacFarlane <jgm@berkeley.edu>
Date

Rename NODE_HTML -> NODE_HTML_BLOCK, NODE_INLINE_HTML -> NODE_HTML_INLINE.

API change. Sorry, but this is the time to break things, before 1.0 is released. This matches the recent changes to CommonMark.dtd.

Diffstat

12 files changed, 44 insertions, 44 deletions

Status File Name N° Changes Insertions Deletions
Modified api_test/main.c 12 6 6
Modified man/man3/cmark.3 6 3 3
Modified src/blocks.c 10 5 5
Modified src/cmark.h 12 6 6
Modified src/commonmark.c 4 2 2
Modified src/html.c 6 3 3
Modified src/inlines.c 2 1 1
Modified src/iterator.c 4 2 2
Modified src/latex.c 4 2 2
Modified src/man.c 4 2 2
Modified src/node.c 20 10 10
Modified src/xml.c 4 2 2
diff --git a/api_test/main.c b/api_test/main.c
@@ -17,7 +17,7 @@ static const cmark_node_type node_types[] = {
 	CMARK_NODE_LIST,
 	CMARK_NODE_ITEM,
 	CMARK_NODE_CODE_BLOCK,
-	CMARK_NODE_HTML,
+	CMARK_NODE_HTML_BLOCK,
 	CMARK_NODE_PARAGRAPH,
 	CMARK_NODE_HEADING,
 	CMARK_NODE_THEMATIC_BREAK,
@@ -25,7 +25,7 @@ static const cmark_node_type node_types[] = {
 	CMARK_NODE_SOFTBREAK,
 	CMARK_NODE_LINEBREAK,
 	CMARK_NODE_CODE,
-	CMARK_NODE_INLINE_HTML,
+	CMARK_NODE_HTML_INLINE,
 	CMARK_NODE_EMPH,
 	CMARK_NODE_STRONG,
 	CMARK_NODE_LINK,
@@ -513,7 +513,7 @@ hierarchy(test_batch_runner *runner)
 		(1 << CMARK_NODE_BLOCK_QUOTE) |
 		(1 << CMARK_NODE_LIST) |
 		(1 << CMARK_NODE_CODE_BLOCK) |
-		(1 << CMARK_NODE_HTML) |
+		(1 << CMARK_NODE_HTML_BLOCK) |
 		(1 << CMARK_NODE_PARAGRAPH) |
 		(1 << CMARK_NODE_HEADING) |
 		(1 << CMARK_NODE_THEMATIC_BREAK);
@@ -522,7 +522,7 @@ hierarchy(test_batch_runner *runner)
 		(1 << CMARK_NODE_SOFTBREAK) |
 		(1 << CMARK_NODE_LINEBREAK) |
 		(1 << CMARK_NODE_CODE) |
-		(1 << CMARK_NODE_INLINE_HTML) |
+		(1 << CMARK_NODE_HTML_INLINE) |
 		(1 << CMARK_NODE_EMPH) |
 		(1 << CMARK_NODE_STRONG) |
 		(1 << CMARK_NODE_LINK) |
@@ -533,7 +533,7 @@ hierarchy(test_batch_runner *runner)
 	test_content(runner, CMARK_NODE_LIST,          list_item_flag);
 	test_content(runner, CMARK_NODE_ITEM,          top_level_blocks);
 	test_content(runner, CMARK_NODE_CODE_BLOCK ,   0);
-	test_content(runner, CMARK_NODE_HTML,          0);
+	test_content(runner, CMARK_NODE_HTML_BLOCK,          0);
 	test_content(runner, CMARK_NODE_PARAGRAPH,     all_inlines);
 	test_content(runner, CMARK_NODE_HEADING,        all_inlines);
 	test_content(runner, CMARK_NODE_THEMATIC_BREAK,         0);
@@ -541,7 +541,7 @@ hierarchy(test_batch_runner *runner)
 	test_content(runner, CMARK_NODE_SOFTBREAK,     0);
 	test_content(runner, CMARK_NODE_LINEBREAK,     0);
 	test_content(runner, CMARK_NODE_CODE,   0);
-	test_content(runner, CMARK_NODE_INLINE_HTML,   0);
+	test_content(runner, CMARK_NODE_HTML_INLINE,   0);
 	test_content(runner, CMARK_NODE_EMPH,          all_inlines);
 	test_content(runner, CMARK_NODE_STRONG,        all_inlines);
 	test_content(runner, CMARK_NODE_LINK,          all_inlines);
diff --git a/man/man3/cmark.3 b/man/man3/cmark.3
@@ -1,4 +1,4 @@
-.TH cmark 3 "December 23, 2015" "LOCAL" "Library Functions Manual"
+.TH cmark 3 "December 28, 2015" "LOCAL" "Library Functions Manual"
 .SH
 NAME
 .PP
@@ -110,7 +110,7 @@ usage_example(cmark_node *root) {
 Iterators will never return \f[C]EXIT\f[] events for leaf nodes, which
 are nodes of type:
 .IP \[bu] 2
-CMARK_NODE_HTML
+CMARK_NODE_HTML_BLOCK
 .IP \[bu] 2
 CMARK_NODE_THEMATIC_BREAK
 .IP \[bu] 2
@@ -124,7 +124,7 @@ CMARK_NODE_LINEBREAK
 .IP \[bu] 2
 CMARK_NODE_CODE
 .IP \[bu] 2
-CMARK_NODE_INLINE_HTML
+CMARK_NODE_HTML_INLINE
 .PP
 Nodes must only be modified after an \f[C]EXIT\f[] event, or an
 \f[C]ENTER\f[] event for leaf nodes.
diff --git a/src/blocks.c b/src/blocks.c
@@ -262,7 +262,7 @@ static cmark_node *finalize(cmark_parser *parser, cmark_node *b) {
     b->as.code.literal = cmark_chunk_buf_detach(&b->string_content);
     break;
 
-  case CMARK_NODE_HTML:
+  case CMARK_NODE_HTML_BLOCK:
     b->as.literal = cmark_chunk_buf_detach(&b->string_content);
     break;
 
@@ -690,7 +690,7 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
       // a heading can never contain more than one line
       all_matched = false;
 
-    } else if (container->type == CMARK_NODE_HTML) {
+    } else if (container->type == CMARK_NODE_HTML_BLOCK) {
 
       switch (container->as.html_block_type) {
       case 1:
@@ -735,7 +735,7 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
   maybe_lazy = parser->current->type == CMARK_NODE_PARAGRAPH;
   // try new container starts:
   while (container->type != CMARK_NODE_CODE_BLOCK &&
-         container->type != CMARK_NODE_HTML) {
+         container->type != CMARK_NODE_HTML_BLOCK) {
 
     S_find_first_nonspace(parser, &input);
     indented = parser->indent >= CODE_INDENT;
@@ -791,7 +791,7 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
                               (matched = scan_html_block_start_7(
                                    &input, parser->first_nonspace))))) {
 
-      container = add_child(parser, container, CMARK_NODE_HTML,
+      container = add_child(parser, container, CMARK_NODE_HTML_BLOCK,
                             parser->first_nonspace + 1);
       container->as.html_block_type = matched;
       // note, we don't adjust parser->offset because the tag is part of the
@@ -933,7 +933,7 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
 
       add_line(container, &input, parser->offset);
 
-    } else if (container->type == CMARK_NODE_HTML) {
+    } else if (container->type == CMARK_NODE_HTML_BLOCK) {
 
       add_line(container, &input, parser->offset);
 
diff --git a/src/cmark.h b/src/cmark.h
@@ -39,7 +39,7 @@ typedef enum {
   CMARK_NODE_LIST,
   CMARK_NODE_ITEM,
   CMARK_NODE_CODE_BLOCK,
-  CMARK_NODE_HTML,
+  CMARK_NODE_HTML_BLOCK,
   CMARK_NODE_CUSTOM_BLOCK,
   CMARK_NODE_PARAGRAPH,
   CMARK_NODE_HEADING,
@@ -53,7 +53,7 @@ typedef enum {
   CMARK_NODE_SOFTBREAK,
   CMARK_NODE_LINEBREAK,
   CMARK_NODE_CODE,
-  CMARK_NODE_INLINE_HTML,
+  CMARK_NODE_HTML_INLINE,
   CMARK_NODE_CUSTOM_INLINE,
   CMARK_NODE_EMPH,
   CMARK_NODE_STRONG,
@@ -163,14 +163,14 @@ CMARK_EXPORT cmark_node *cmark_node_last_child(cmark_node *node);
  * Iterators will never return `EXIT` events for leaf nodes, which are nodes
  * of type:
  *
- * * CMARK_NODE_HTML
+ * * CMARK_NODE_HTML_BLOCK
  * * CMARK_NODE_THEMATIC_BREAK
  * * CMARK_NODE_CODE_BLOCK
  * * CMARK_NODE_TEXT
  * * CMARK_NODE_SOFTBREAK
  * * CMARK_NODE_LINEBREAK
  * * CMARK_NODE_CODE
- * * CMARK_NODE_INLINE_HTML
+ * * CMARK_NODE_HTML_INLINE
  *
  * Nodes must only be modified after an `EXIT` event, or an `ENTER` event for
  * leaf nodes.
@@ -561,7 +561,7 @@ const char *cmark_version_string();
 #define NODE_LIST CMARK_NODE_LIST
 #define NODE_ITEM CMARK_NODE_ITEM
 #define NODE_CODE_BLOCK CMARK_NODE_CODE_BLOCK
-#define NODE_HTML CMARK_NODE_HTML
+#define NODE_HTML_BLOCK CMARK_NODE_HTML_BLOCK
 #define NODE_CUSTOM_BLOCK CMARK_NODE_CUSTOM_BLOCK
 #define NODE_PARAGRAPH CMARK_NODE_PARAGRAPH
 #define NODE_HEADING CMARK_NODE_HEADING
@@ -572,7 +572,7 @@ const char *cmark_version_string();
 #define NODE_SOFTBREAK CMARK_NODE_SOFTBREAK
 #define NODE_LINEBREAK CMARK_NODE_LINEBREAK
 #define NODE_CODE CMARK_NODE_CODE
-#define NODE_INLINE_HTML CMARK_NODE_INLINE_HTML
+#define NODE_HTML_INLINE CMARK_NODE_HTML_INLINE
 #define NODE_CUSTOM_INLINE CMARK_NODE_CUSTOM_INLINE
 #define NODE_EMPH CMARK_NODE_EMPH
 #define NODE_STRONG CMARK_NODE_STRONG
diff --git a/src/commonmark.c b/src/commonmark.c
@@ -279,7 +279,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
     BLANKLINE();
     break;
 
-  case CMARK_NODE_HTML:
+  case CMARK_NODE_HTML_BLOCK:
     BLANKLINE();
     OUT(cmark_node_get_literal(node), false, LITERAL);
     BLANKLINE();
@@ -342,7 +342,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
     }
     break;
 
-  case CMARK_NODE_INLINE_HTML:
+  case CMARK_NODE_HTML_INLINE:
     OUT(cmark_node_get_literal(node), false, LITERAL);
     break;
 
diff --git a/src/html.c b/src/html.c
@@ -58,7 +58,7 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
     switch (node->type) {
     case CMARK_NODE_TEXT:
     case CMARK_NODE_CODE:
-    case CMARK_NODE_INLINE_HTML:
+    case CMARK_NODE_HTML_INLINE:
       escape_html(html, node->as.literal.data, node->as.literal.len);
       break;
 
@@ -166,7 +166,7 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
     cmark_strbuf_puts(html, "</code></pre>\n");
     break;
 
-  case CMARK_NODE_HTML:
+  case CMARK_NODE_HTML_BLOCK:
     cr(html);
     if (options & CMARK_OPT_SAFE) {
       cmark_strbuf_puts(html, "<!-- raw HTML omitted -->");
@@ -237,7 +237,7 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
     cmark_strbuf_puts(html, "</code>");
     break;
 
-  case CMARK_NODE_INLINE_HTML:
+  case CMARK_NODE_HTML_INLINE:
     if (options & CMARK_OPT_SAFE) {
       cmark_strbuf_puts(html, "<!-- raw HTML omitted -->");
     } else {
diff --git a/src/inlines.c b/src/inlines.c
@@ -24,7 +24,7 @@ static const char *RIGHTSINGLEQUOTE = "\xE2\x80\x99";
 // Macros for creating various kinds of simple.
 #define make_str(s) make_literal(CMARK_NODE_TEXT, s)
 #define make_code(s) make_literal(CMARK_NODE_CODE, s)
-#define make_raw_html(s) make_literal(CMARK_NODE_INLINE_HTML, s)
+#define make_raw_html(s) make_literal(CMARK_NODE_HTML_INLINE, s)
 #define make_linebreak() make_simple(CMARK_NODE_LINEBREAK)
 #define make_softbreak() make_simple(CMARK_NODE_SOFTBREAK)
 #define make_emph() make_simple(CMARK_NODE_EMPH)
diff --git a/src/iterator.c b/src/iterator.c
@@ -7,10 +7,10 @@
 #include "iterator.h"
 
 static const int S_leaf_mask =
-    (1 << CMARK_NODE_HTML) | (1 << CMARK_NODE_THEMATIC_BREAK) |
+    (1 << CMARK_NODE_HTML_BLOCK) | (1 << CMARK_NODE_THEMATIC_BREAK) |
     (1 << CMARK_NODE_CODE_BLOCK) | (1 << CMARK_NODE_TEXT) |
     (1 << CMARK_NODE_SOFTBREAK) | (1 << CMARK_NODE_LINEBREAK) |
-    (1 << CMARK_NODE_CODE) | (1 << CMARK_NODE_INLINE_HTML);
+    (1 << CMARK_NODE_CODE) | (1 << CMARK_NODE_HTML_INLINE);
 
 cmark_iter *cmark_iter_new(cmark_node *root) {
   if (root == NULL) {
diff --git a/src/latex.c b/src/latex.c
@@ -308,7 +308,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
     BLANKLINE();
     break;
 
-  case CMARK_NODE_HTML:
+  case CMARK_NODE_HTML_BLOCK:
     break;
 
   case CMARK_NODE_CUSTOM_BLOCK:
@@ -353,7 +353,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
     LIT("}");
     break;
 
-  case CMARK_NODE_INLINE_HTML:
+  case CMARK_NODE_HTML_INLINE:
     break;
 
   case CMARK_NODE_CUSTOM_INLINE:
diff --git a/src/man.c b/src/man.c
@@ -139,7 +139,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
     CR();
     break;
 
-  case CMARK_NODE_HTML:
+  case CMARK_NODE_HTML_BLOCK:
     break;
 
   case CMARK_NODE_CUSTOM_BLOCK:
@@ -194,7 +194,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
     LIT("\\f[]");
     break;
 
-  case CMARK_NODE_INLINE_HTML:
+  case CMARK_NODE_HTML_INLINE:
     break;
 
   case CMARK_NODE_CUSTOM_INLINE:
diff --git a/src/node.c b/src/node.c
@@ -105,9 +105,9 @@ static void S_free_nodes(cmark_node *e) {
       cmark_chunk_free(&e->as.code.literal);
       break;
     case CMARK_NODE_TEXT:
-    case CMARK_NODE_INLINE_HTML:
+    case CMARK_NODE_HTML_INLINE:
     case CMARK_NODE_CODE:
-    case CMARK_NODE_HTML:
+    case CMARK_NODE_HTML_BLOCK:
       cmark_chunk_free(&e->as.literal);
       break;
     case CMARK_NODE_LINK:
@@ -166,8 +166,8 @@ const char *cmark_node_get_type_string(cmark_node *node) {
     return "item";
   case CMARK_NODE_CODE_BLOCK:
     return "code_block";
-  case CMARK_NODE_HTML:
-    return "html";
+  case CMARK_NODE_HTML_BLOCK:
+    return "html_block";
   case CMARK_NODE_CUSTOM_BLOCK:
     return "raw_block";
   case CMARK_NODE_PARAGRAPH:
@@ -184,8 +184,8 @@ const char *cmark_node_get_type_string(cmark_node *node) {
     return "linebreak";
   case CMARK_NODE_CODE:
     return "code";
-  case CMARK_NODE_INLINE_HTML:
-    return "inline_html";
+  case CMARK_NODE_HTML_INLINE:
+    return "html_inline";
   case CMARK_NODE_CUSTOM_INLINE:
     return "raw_inline";
   case CMARK_NODE_EMPH:
@@ -263,9 +263,9 @@ const char *cmark_node_get_literal(cmark_node *node) {
   }
 
   switch (node->type) {
-  case CMARK_NODE_HTML:
+  case CMARK_NODE_HTML_BLOCK:
   case CMARK_NODE_TEXT:
-  case CMARK_NODE_INLINE_HTML:
+  case CMARK_NODE_HTML_INLINE:
   case CMARK_NODE_CODE:
     return cmark_chunk_to_cstr(&node->as.literal);
 
@@ -285,9 +285,9 @@ int cmark_node_set_literal(cmark_node *node, const char *content) {
   }
 
   switch (node->type) {
-  case CMARK_NODE_HTML:
+  case CMARK_NODE_HTML_BLOCK:
   case CMARK_NODE_TEXT:
-  case CMARK_NODE_INLINE_HTML:
+  case CMARK_NODE_HTML_INLINE:
   case CMARK_NODE_CODE:
     cmark_chunk_set_cstr(&node->as.literal, content);
     return 1;
diff --git a/src/xml.c b/src/xml.c
@@ -55,8 +55,8 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
       break;
     case CMARK_NODE_TEXT:
     case CMARK_NODE_CODE:
-    case CMARK_NODE_HTML:
-    case CMARK_NODE_INLINE_HTML:
+    case CMARK_NODE_HTML_BLOCK:
+    case CMARK_NODE_HTML_INLINE:
       cmark_strbuf_puts(xml, ">");
       escape_xml(xml, node->as.literal.data, node->as.literal.len);
       cmark_strbuf_puts(xml, "</");