summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-12-22 22:41:33 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-12-22 22:41:33 -0800
commitde6c5fb2c45dfa2791074f7d99a27b23b2106dfc (patch)
tree7416568ce255cfcaa14e3a8901966df0c5a2c906 /src
parenta74295a1ea686611498a75dd45597d224ce99287 (diff)
CMARK_NODE_HEADER -> CMARK_NODE_HEADING.
Defined CMARK_NODE_HEADER to CMARK_NODE_HEADING to ease the transition.
Diffstat (limited to 'src')
-rw-r--r--src/blocks.c16
-rw-r--r--src/cmark.h6
-rw-r--r--src/commonmark.c2
-rw-r--r--src/html.c2
-rw-r--r--src/latex.c2
-rw-r--r--src/man.c2
-rw-r--r--src/node.c10
-rw-r--r--src/xml.c2
8 files changed, 23 insertions, 19 deletions
diff --git a/src/blocks.c b/src/blocks.c
index a943303..3877747 100644
--- a/src/blocks.c
+++ b/src/blocks.c
@@ -120,7 +120,7 @@ static inline bool can_contain(cmark_node_type parent_type,
static inline bool accepts_lines(cmark_node_type block_type) {
return (block_type == CMARK_NODE_PARAGRAPH ||
- block_type == CMARK_NODE_HEADER ||
+ block_type == CMARK_NODE_HEADING ||
block_type == CMARK_NODE_CODE_BLOCK);
}
@@ -208,7 +208,7 @@ static cmark_node *finalize(cmark_parser *parser, cmark_node *b) {
b->end_column = parser->last_line_length;
} else if (b->type == CMARK_NODE_DOCUMENT ||
(b->type == CMARK_NODE_CODE_BLOCK && b->as.code.fenced) ||
- (b->type == CMARK_NODE_HEADER && b->as.heading.setext)) {
+ (b->type == CMARK_NODE_HEADING && b->as.heading.setext)) {
b->end_line = parser->line_number;
b->end_column = parser->curline->size;
if (b->end_column && parser->curline->ptr[b->end_column - 1] == '\n')
@@ -336,7 +336,7 @@ static void process_inlines(cmark_node *root, cmark_reference_map *refmap,
while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) {
cur = cmark_iter_get_node(iter);
if (ev_type == CMARK_EVENT_ENTER) {
- if (cur->type == CMARK_NODE_PARAGRAPH || cur->type == CMARK_NODE_HEADER) {
+ if (cur->type == CMARK_NODE_PARAGRAPH || cur->type == CMARK_NODE_HEADING) {
cmark_parse_inlines(cur, refmap, options);
}
}
@@ -685,7 +685,7 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
}
}
}
- } else if (container->type == CMARK_NODE_HEADER) {
+ } else if (container->type == CMARK_NODE_HEADING) {
// a heading can never contain more than one line
all_matched = false;
@@ -757,7 +757,7 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
parser->first_nonspace + matched - parser->offset,
false);
container =
- add_child(parser, container, CMARK_NODE_HEADER, parser->offset + 1);
+ add_child(parser, container, CMARK_NODE_HEADING, parser->offset + 1);
bufsize_t hashpos =
cmark_chunk_strchr(&input, '#', parser->first_nonspace);
@@ -805,7 +805,7 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
&container->string_content, '\n',
cmark_strbuf_len(&container->string_content) - 2) < 0)) {
- container->type = CMARK_NODE_HEADER;
+ container->type = CMARK_NODE_HEADING;
container->as.heading.level = lev;
container->as.heading.setext = true;
S_advance_offset(parser, &input, input.len - 1 - parser->offset, false);
@@ -901,7 +901,7 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
// on an empty list item.
container->last_line_blank =
(parser->blank && container->type != CMARK_NODE_BLOCK_QUOTE &&
- container->type != CMARK_NODE_HEADER &&
+ container->type != CMARK_NODE_HEADING &&
container->type != CMARK_NODE_HRULE &&
!(container->type == CMARK_NODE_CODE_BLOCK &&
container->as.code.fenced) &&
@@ -980,7 +980,7 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
} else if (accepts_lines(container->type)) {
- if (container->type == CMARK_NODE_HEADER &&
+ if (container->type == CMARK_NODE_HEADING &&
container->as.heading.setext == false) {
chop_trailing_hashtags(&input);
}
diff --git a/src/cmark.h b/src/cmark.h
index ec36e02..cbcb265 100644
--- a/src/cmark.h
+++ b/src/cmark.h
@@ -42,7 +42,7 @@ typedef enum {
CMARK_NODE_HTML,
CMARK_NODE_CUSTOM_BLOCK,
CMARK_NODE_PARAGRAPH,
- CMARK_NODE_HEADER,
+ CMARK_NODE_HEADING,
CMARK_NODE_HRULE,
CMARK_NODE_FIRST_BLOCK = CMARK_NODE_DOCUMENT,
@@ -64,6 +64,9 @@ typedef enum {
CMARK_NODE_LAST_INLINE = CMARK_NODE_IMAGE,
} cmark_node_type;
+/* For backwards compatibility: */
+#define CMARK_NODE_HEADER CMARK_NODE_HEADING
+
typedef enum {
CMARK_NO_LIST,
CMARK_BULLET_LIST,
@@ -548,6 +551,7 @@ const char *cmark_version_string();
#define NODE_HTML CMARK_NODE_HTML
#define NODE_CUSTOM_BLOCK CMARK_NODE_CUSTOM_BLOCK
#define NODE_PARAGRAPH CMARK_NODE_PARAGRAPH
+#define NODE_HEADING CMARK_NODE_HEADING
#define NODE_HEADER CMARK_NODE_HEADER
#define NODE_HRULE CMARK_NODE_HRULE
#define NODE_TEXT CMARK_NODE_TEXT
diff --git a/src/commonmark.c b/src/commonmark.c
index 57a8747..9b9971b 100644
--- a/src/commonmark.c
+++ b/src/commonmark.c
@@ -228,7 +228,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
}
break;
- case CMARK_NODE_HEADER:
+ case CMARK_NODE_HEADING:
if (entering) {
for (i = cmark_node_get_heading_level(node); i > 0; i--) {
LIT("#");
diff --git a/src/html.c b/src/html.c
index beda214..6e8b0fc 100644
--- a/src/html.c
+++ b/src/html.c
@@ -127,7 +127,7 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
}
break;
- case CMARK_NODE_HEADER:
+ case CMARK_NODE_HEADING:
if (entering) {
cr(html);
start_heading[2] = (char)('0' + node->as.heading.level);
diff --git a/src/latex.c b/src/latex.c
index 6d3c4af..d87dfc0 100644
--- a/src/latex.c
+++ b/src/latex.c
@@ -264,7 +264,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
}
break;
- case CMARK_NODE_HEADER:
+ case CMARK_NODE_HEADING:
if (entering) {
switch (cmark_node_get_heading_level(node)) {
case 1:
diff --git a/src/man.c b/src/man.c
index 42f6e4a..941cda9 100644
--- a/src/man.c
+++ b/src/man.c
@@ -120,7 +120,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
}
break;
- case CMARK_NODE_HEADER:
+ case CMARK_NODE_HEADING:
if (entering) {
CR();
LIT(cmark_node_get_heading_level(node) == 1 ? ".SH" : ".SS");
diff --git a/src/node.c b/src/node.c
index ea0913b..d8b1b15 100644
--- a/src/node.c
+++ b/src/node.c
@@ -53,7 +53,7 @@ static bool S_can_contain(cmark_node *node, cmark_node *child) {
return child->type == CMARK_NODE_ITEM;
case CMARK_NODE_PARAGRAPH:
- case CMARK_NODE_HEADER:
+ case CMARK_NODE_HEADING:
case CMARK_NODE_EMPH:
case CMARK_NODE_STRONG:
case CMARK_NODE_LINK:
@@ -73,7 +73,7 @@ cmark_node *cmark_node_new(cmark_node_type type) {
node->type = type;
switch (node->type) {
- case CMARK_NODE_HEADER:
+ case CMARK_NODE_HEADING:
node->as.heading.level = 1;
break;
@@ -172,7 +172,7 @@ const char *cmark_node_get_type_string(cmark_node *node) {
return "raw_block";
case CMARK_NODE_PARAGRAPH:
return "paragraph";
- case CMARK_NODE_HEADER:
+ case CMARK_NODE_HEADING:
return "heading";
case CMARK_NODE_HRULE:
return "hrule";
@@ -309,7 +309,7 @@ int cmark_node_get_heading_level(cmark_node *node) {
}
switch (node->type) {
- case CMARK_NODE_HEADER:
+ case CMARK_NODE_HEADING:
return node->as.heading.level;
default:
@@ -325,7 +325,7 @@ int cmark_node_set_heading_level(cmark_node *node, int level) {
}
switch (node->type) {
- case CMARK_NODE_HEADER:
+ case CMARK_NODE_HEADING:
node->as.heading.level = level;
return 1;
diff --git a/src/xml.c b/src/xml.c
index 65f8527..939a821 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -86,7 +86,7 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
(cmark_node_get_list_tight(node) ? "true" : "false"));
cmark_strbuf_puts(xml, buffer);
break;
- case CMARK_NODE_HEADER:
+ case CMARK_NODE_HEADING:
sprintf(buffer, " level=\"%d\"", node->as.heading.level);
cmark_strbuf_puts(xml, buffer);
break;