summaryrefslogtreecommitdiff
path: root/src/blocks.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-11-23 06:54:53 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-11-23 06:54:53 -0800
commit8ba087276c6cae9e1efde656ae973b4f714c88be (patch)
treebf90502882077bb8c7ea8bc041843c88c92a6526 /src/blocks.c
parentd929a2983db96be22277c2052ea61cd8ec7ac6f1 (diff)
Revert "Revert "Remove distinction btw atx and setext header in AST.""
This reverts commit 4570eb2bff2e1b71fa5b6408abbc69c98ff5ff24.
Diffstat (limited to 'src/blocks.c')
-rw-r--r--src/blocks.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/blocks.c b/src/blocks.c
index c74b425..4a3f4fa 100644
--- a/src/blocks.c
+++ b/src/blocks.c
@@ -97,9 +97,9 @@ static inline bool can_contain(cmark_node_type parent_type, cmark_node_type chil
static inline bool accepts_lines(cmark_node_type block_type)
{
return (block_type == NODE_PARAGRAPH ||
- block_type == NODE_ATX_HEADER ||
- block_type == NODE_INDENTED_CODE ||
- block_type == NODE_FENCED_CODE);
+ block_type == NODE_HEADER ||
+ block_type == NODE_INDENTED_CODE ||
+ block_type == NODE_FENCED_CODE);
}
static void add_line(cmark_node* cmark_node, chunk *ch, int offset)
@@ -293,8 +293,7 @@ static void process_inlines(cmark_node* cur, reference_map *refmap)
while (cur != NULL) {
switch (cur->type) {
case NODE_PARAGRAPH:
- case NODE_ATX_HEADER:
- case NODE_SETEXT_HEADER:
+ case NODE_HEADER:
parse_inlines(cur, refmap);
break;
@@ -548,8 +547,7 @@ void cmark_process_line(cmark_doc_parser *parser, const char *buffer,
all_matched = false;
}
- } else if (container->type == NODE_ATX_HEADER ||
- container->type == NODE_SETEXT_HEADER) {
+ } else if (container->type == NODE_HEADER) {
// a header can never contain more than one line
all_matched = false;
@@ -625,7 +623,7 @@ void cmark_process_line(cmark_doc_parser *parser, const char *buffer,
} else if ((matched = scan_atx_header_start(&input, first_nonspace))) {
offset = first_nonspace + matched;
- container = add_child(parser, container, NODE_ATX_HEADER, parser->line_number, offset + 1);
+ container = add_child(parser, container, NODE_HEADER, parser->line_number, offset + 1);
int hashpos = chunk_strchr(&input, '#', first_nonspace);
int level = 0;
@@ -655,7 +653,7 @@ void cmark_process_line(cmark_doc_parser *parser, const char *buffer,
strbuf_strrchr(&container->string_content, '\n',
strbuf_len(&container->string_content) - 2) < 0) {
- container->type = NODE_SETEXT_HEADER;
+ container->type = NODE_HEADER;
container->as.header.level = lev;
offset = input.len - 1;
@@ -732,7 +730,7 @@ void cmark_process_line(cmark_doc_parser *parser, const char *buffer,
// on an empty list item.
container->last_line_blank = (blank &&
container->type != NODE_BLOCK_QUOTE &&
- container->type != NODE_SETEXT_HEADER &&
+ container->type != NODE_HEADER &&
container->type != NODE_FENCED_CODE &&
!(container->type == NODE_LIST_ITEM &&
container->first_child == NULL &&
@@ -791,7 +789,7 @@ void cmark_process_line(cmark_doc_parser *parser, const char *buffer,
// ??? do nothing
- } else if (container->type == NODE_ATX_HEADER) {
+ } else if (container->type == NODE_HEADER) {
chop_trailing_hashtags(&input);
add_line(container, &input, first_nonspace);
@@ -802,7 +800,8 @@ void cmark_process_line(cmark_doc_parser *parser, const char *buffer,
add_line(container, &input, first_nonspace);
- } else if (container->type != NODE_HRULE && container->type != NODE_SETEXT_HEADER) {
+ } else if (container->type != NODE_HRULE &&
+ container->type != NODE_HEADER) {
// create paragraph container for line
container = add_child(parser, container, NODE_PARAGRAPH, parser->line_number, first_nonspace + 1);