cmark

My personal build of CMark ✏️

Commit
acac9428faa1c3193fb44b3fb0e2dd3cbdaa4ac9
Parent
a3be6dc81c971fa1b3c656d82f7e96794d510212
Author
John MacFarlane <jgm@berkeley.edu>
Date

Renamed NODE_BQUOTE -> NODE_BLOCK_QUOTE.

Diffstat

6 files changed, 18 insertions, 18 deletions

Status File Name N° Changes Insertions Deletions
Modified api_test/main.c 12 6 6
Modified src/blocks.c 8 4 4
Modified src/cmark.h 4 2 2
Modified src/html/html.c 6 3 3
Modified src/node.c 4 2 2
Modified src/print.c 2 1 1
diff --git a/api_test/main.c b/api_test/main.c
@@ -10,7 +10,7 @@
 
 static const cmark_node_type node_types[] = {
 	CMARK_NODE_DOCUMENT,
-	CMARK_NODE_BQUOTE,
+	CMARK_NODE_BLOCK_QUOTE,
 	CMARK_NODE_LIST,
 	CMARK_NODE_LIST_ITEM,
 	CMARK_NODE_FENCED_CODE,
@@ -353,9 +353,9 @@ create_tree(test_batch_runner *runner)
 void
 hierarchy(test_batch_runner *runner)
 {
-	cmark_node *bquote1 = cmark_node_new(CMARK_NODE_BQUOTE);
-	cmark_node *bquote2 = cmark_node_new(CMARK_NODE_BQUOTE);
-	cmark_node *bquote3 = cmark_node_new(CMARK_NODE_BQUOTE);
+	cmark_node *bquote1 = cmark_node_new(CMARK_NODE_BLOCK_QUOTE);
+	cmark_node *bquote2 = cmark_node_new(CMARK_NODE_BLOCK_QUOTE);
+	cmark_node *bquote3 = cmark_node_new(CMARK_NODE_BLOCK_QUOTE);
 
 	OK(runner, cmark_node_append_child(bquote1, bquote2),
 	   "append bquote2");
@@ -374,7 +374,7 @@ hierarchy(test_batch_runner *runner)
 
 	int list_item_flag = 1 << CMARK_NODE_LIST_ITEM;
 	int top_level_blocks =
-		(1 << CMARK_NODE_BQUOTE) |
+		(1 << CMARK_NODE_BLOCK_QUOTE) |
 		(1 << CMARK_NODE_LIST) |
 		(1 << CMARK_NODE_FENCED_CODE) |
 		(1 << CMARK_NODE_INDENTED_CODE) |
@@ -396,7 +396,7 @@ hierarchy(test_batch_runner *runner)
 		(1 << CMARK_NODE_IMAGE);
 
 	test_content(runner, CMARK_NODE_DOCUMENT,      top_level_blocks);
-	test_content(runner, CMARK_NODE_BQUOTE,        top_level_blocks);
+	test_content(runner, CMARK_NODE_BLOCK_QUOTE,   top_level_blocks);
 	test_content(runner, CMARK_NODE_LIST,          list_item_flag);
 	test_content(runner, CMARK_NODE_LIST_ITEM,     top_level_blocks);
 	test_content(runner, CMARK_NODE_FENCED_CODE,   0);
diff --git a/src/blocks.c b/src/blocks.c
@@ -89,7 +89,7 @@ static bool is_blank(strbuf *s, int offset)
 static inline bool can_contain(cmark_node_type parent_type, cmark_node_type child_type)
 {
 	return ( parent_type == NODE_DOCUMENT ||
-			parent_type == NODE_BQUOTE ||
+			parent_type == NODE_BLOCK_QUOTE ||
 			parent_type == NODE_LIST_ITEM ||
 			(parent_type == NODE_LIST && child_type == NODE_LIST_ITEM) );
 }
@@ -516,7 +516,7 @@ void cmark_process_line(cmark_doc_parser *parser, const char *buffer,
 		indent = first_nonspace - offset;
 		blank = peek_at(&input, first_nonspace) == '\n';
 
-		if (container->type == NODE_BQUOTE) {
+		if (container->type == NODE_BLOCK_QUOTE) {
 			matched = indent <= 3 && peek_at(&input, first_nonspace) == '>';
 			if (matched) {
 				offset = first_nonspace + 1;
@@ -620,7 +620,7 @@ void cmark_process_line(cmark_doc_parser *parser, const char *buffer,
 			// optional following character
 			if (peek_at(&input, offset) == ' ')
 				offset++;
-			container = add_child(parser, container, NODE_BQUOTE, parser->line_number, offset + 1);
+			container = add_child(parser, container, NODE_BLOCK_QUOTE, parser->line_number, offset + 1);
 
 		} else if ((matched = scan_atx_header_start(&input, first_nonspace))) {
 
@@ -731,7 +731,7 @@ void cmark_process_line(cmark_doc_parser *parser, const char *buffer,
 	// lists or breaking out of lists.  we also don't set last_line_blank
 	// on an empty list item.
 	container->last_line_blank = (blank &&
-			container->type != NODE_BQUOTE &&
+			container->type != NODE_BLOCK_QUOTE &&
 			container->type != NODE_SETEXT_HEADER &&
 			container->type != NODE_FENCED_CODE &&
 			!(container->type == NODE_LIST_ITEM &&
diff --git a/src/cmark.h b/src/cmark.h
@@ -13,7 +13,7 @@ extern "C" {
 typedef enum {
     // Block
     CMARK_NODE_DOCUMENT,
-    CMARK_NODE_BQUOTE,
+    CMARK_NODE_BLOCK_QUOTE,
     CMARK_NODE_LIST,
     CMARK_NODE_LIST_ITEM,
     CMARK_NODE_FENCED_CODE,
@@ -197,7 +197,7 @@ char *cmark_markdown_to_html(const char *text, int len);
 
 #ifndef CMARK_NO_SHORT_NAMES
   #define NODE_DOCUMENT             CMARK_NODE_DOCUMENT
-  #define NODE_BQUOTE               CMARK_NODE_BQUOTE
+  #define NODE_BLOCK_QUOTE          CMARK_NODE_BLOCK_QUOTE
   #define NODE_LIST                 CMARK_NODE_LIST
   #define NODE_LIST_ITEM            CMARK_NODE_LIST_ITEM
   #define NODE_FENCED_CODE          CMARK_NODE_FENCED_CODE
diff --git a/src/html/html.c b/src/html/html.c
@@ -109,10 +109,10 @@ static void node_to_html(strbuf *html, cmark_node *node)
 			}
 			break;
 
-		case NODE_BQUOTE:
+		case NODE_BLOCK_QUOTE:
 			cr(html);
 			strbuf_puts(html, "<blockquote>\n");
-			// BQUOTE doesn't use any of the 'as' structs,
+			// BLOCK_QUOTE doesn't use any of the 'as' structs,
 			// so the 'list' member can be used to store the
 			// current value of 'tight'.
 			cur->as.list.tight = tight;
@@ -290,7 +290,7 @@ finish_node(strbuf *html, cmark_node *node, bool tight)
 		}
 		break;
 
-	case NODE_BQUOTE: {
+	case NODE_BLOCK_QUOTE: {
 		cmark_list *list = &node->as.list;
 		strbuf_puts(html, "</blockquote>\n");
 		// Restore old 'tight' value.
diff --git a/src/node.c b/src/node.c
@@ -51,7 +51,7 @@ S_type_string(cmark_node *node)
 {
 	switch (node->type) {
 	case CMARK_NODE_DOCUMENT:      return "DOCUMENT";
-	case CMARK_NODE_BQUOTE:        return "BQUOTE";
+	case CMARK_NODE_BLOCK_QUOTE:   return "BLOCK_QUOTE";
 	case CMARK_NODE_LIST:          return "LIST";
 	case CMARK_NODE_LIST_ITEM:     return "LIST_ITEM";
 	case CMARK_NODE_FENCED_CODE:   return "FENCED_CODE";
@@ -384,7 +384,7 @@ S_can_contain(cmark_node *node, cmark_node *child)
 
 	switch (node->type) {
 	case CMARK_NODE_DOCUMENT:
-	case CMARK_NODE_BQUOTE:
+	case CMARK_NODE_BLOCK_QUOTE:
 	case CMARK_NODE_LIST_ITEM:
 		return S_is_block(child)
 		       && child->type != CMARK_NODE_LIST_ITEM;
diff --git a/src/print.c b/src/print.c
@@ -110,7 +110,7 @@ static void print_blocks(cmark_node* b, int indent)
 			printf("document\n");
 			print_blocks(b->first_child, indent + 2);
 			break;
-		case NODE_BQUOTE:
+		case NODE_BLOCK_QUOTE:
 			printf("block_quote\n");
 			print_blocks(b->first_child, indent + 2);
 			break;