From 6e599f2ceb8ca1aee0cdb47d37aba16ac5938641 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 28 Dec 2015 11:46:33 -0800 Subject: 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. --- src/blocks.c | 10 +++++----- src/cmark.h | 12 ++++++------ src/commonmark.c | 4 ++-- src/html.c | 6 +++--- src/inlines.c | 2 +- src/iterator.c | 4 ++-- src/latex.c | 4 ++-- src/man.c | 4 ++-- src/node.c | 20 ++++++++++---------- src/xml.c | 4 ++-- 10 files changed, 35 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/blocks.c b/src/blocks.c index 259fa54..6f2e5c8 100644 --- 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 index 1e6ad35..1f4efa4 100644 --- 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 index c45e5d4..61ef016 100644 --- 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 index 36dacf7..7493596 100644 --- 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, "\n"); break; - case CMARK_NODE_HTML: + case CMARK_NODE_HTML_BLOCK: cr(html); if (options & CMARK_OPT_SAFE) { cmark_strbuf_puts(html, ""); @@ -237,7 +237,7 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, cmark_strbuf_puts(html, ""); break; - case CMARK_NODE_INLINE_HTML: + case CMARK_NODE_HTML_INLINE: if (options & CMARK_OPT_SAFE) { cmark_strbuf_puts(html, ""); } else { diff --git a/src/inlines.c b/src/inlines.c index 38ee0fb..8aa32f4 100644 --- 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 index 0abc1bf..c477f01 100644 --- 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 index 4ad8b89..c961a08 100644 --- 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 index 9299912..99a2803 100644 --- 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 index c48946d..d4c39cc 100644 --- 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 index ef95484..df3e9a7 100644 --- 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, "