diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-12-22 22:55:39 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-12-22 22:55:39 -0800 |
commit | 4811dc3ec2330f015444ac6f5ee4f8cbf3563808 (patch) | |
tree | 05ba17dcc8b7c3c6f4e6fa274c4f22aaf6cee708 /src | |
parent | de6c5fb2c45dfa2791074f7d99a27b23b2106dfc (diff) |
Rename hrule -> thematic_break.
CMARK_NODE_HRULE -> CMARK_NODE_THEMATIC_BREAK.
However we've defined the former as the latter to keep
backwards compatibility.
See jgm/CommonMark 8fa94cb460f5e516b0e57adca33f50a669d51f6c
Diffstat (limited to 'src')
-rw-r--r-- | src/blocks.c | 6 | ||||
-rw-r--r-- | src/cmark.h | 8 | ||||
-rw-r--r-- | src/commonmark.c | 2 | ||||
-rw-r--r-- | src/html.c | 2 | ||||
-rw-r--r-- | src/iterator.c | 2 | ||||
-rw-r--r-- | src/latex.c | 2 | ||||
-rw-r--r-- | src/man.c | 2 | ||||
-rw-r--r-- | src/node.c | 4 | ||||
-rw-r--r-- | src/scanners.c | 4 | ||||
-rw-r--r-- | src/scanners.h | 4 | ||||
-rw-r--r-- | src/scanners.re | 4 |
11 files changed, 21 insertions, 19 deletions
diff --git a/src/blocks.c b/src/blocks.c index 3877747..82edba4 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -812,10 +812,10 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer, } else if (!indented && !(container->type == CMARK_NODE_PARAGRAPH && !all_matched) && - (matched = scan_hrule(&input, parser->first_nonspace))) { + (matched = scan_thematic_break(&input, parser->first_nonspace))) { // it's only now that we know the line is not part of a setext heading: - container = add_child(parser, container, CMARK_NODE_HRULE, + container = add_child(parser, container, CMARK_NODE_THEMATIC_BREAK, parser->first_nonspace + 1); S_advance_offset(parser, &input, input.len - 1 - parser->offset, false); @@ -902,7 +902,7 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer, container->last_line_blank = (parser->blank && container->type != CMARK_NODE_BLOCK_QUOTE && container->type != CMARK_NODE_HEADING && - container->type != CMARK_NODE_HRULE && + container->type != CMARK_NODE_THEMATIC_BREAK && !(container->type == CMARK_NODE_CODE_BLOCK && container->as.code.fenced) && !(container->type == CMARK_NODE_ITEM && container->first_child == NULL && diff --git a/src/cmark.h b/src/cmark.h index cbcb265..0200410 100644 --- a/src/cmark.h +++ b/src/cmark.h @@ -43,10 +43,10 @@ typedef enum { CMARK_NODE_CUSTOM_BLOCK, CMARK_NODE_PARAGRAPH, CMARK_NODE_HEADING, - CMARK_NODE_HRULE, + CMARK_NODE_THEMATIC_BREAK, CMARK_NODE_FIRST_BLOCK = CMARK_NODE_DOCUMENT, - CMARK_NODE_LAST_BLOCK = CMARK_NODE_HRULE, + CMARK_NODE_LAST_BLOCK = CMARK_NODE_THEMATIC_BREAK, /* Inline */ CMARK_NODE_TEXT, @@ -66,6 +66,7 @@ typedef enum { /* For backwards compatibility: */ #define CMARK_NODE_HEADER CMARK_NODE_HEADING +#define CMARK_NODE_HRULE CMARK_NODE_THEMATIC_BREAK typedef enum { CMARK_NO_LIST, @@ -163,7 +164,7 @@ CMARK_EXPORT cmark_node *cmark_node_last_child(cmark_node *node); * of type: * * * CMARK_NODE_HTML - * * CMARK_NODE_HRULE + * * CMARK_NODE_THEMATIC_BREAK * * CMARK_NODE_CODE_BLOCK * * CMARK_NODE_TEXT * * CMARK_NODE_SOFTBREAK @@ -553,6 +554,7 @@ const char *cmark_version_string(); #define NODE_PARAGRAPH CMARK_NODE_PARAGRAPH #define NODE_HEADING CMARK_NODE_HEADING #define NODE_HEADER CMARK_NODE_HEADER +#define NODE_THEMATIC_BREAK CMARK_NODE_THEMATIC_BREAK #define NODE_HRULE CMARK_NODE_HRULE #define NODE_TEXT CMARK_NODE_TEXT #define NODE_SOFTBREAK CMARK_NODE_SOFTBREAK diff --git a/src/commonmark.c b/src/commonmark.c index 9b9971b..c45e5d4 100644 --- a/src/commonmark.c +++ b/src/commonmark.c @@ -292,7 +292,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, BLANKLINE(); break; - case CMARK_NODE_HRULE: + case CMARK_NODE_THEMATIC_BREAK: BLANKLINE(); LIT("-----"); BLANKLINE(); @@ -188,7 +188,7 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, cr(html); break; - case CMARK_NODE_HRULE: + case CMARK_NODE_THEMATIC_BREAK: cr(html); cmark_strbuf_puts(html, "<hr"); S_render_sourcepos(node, html, options); diff --git a/src/iterator.c b/src/iterator.c index 19dfff8..0abc1bf 100644 --- a/src/iterator.c +++ b/src/iterator.c @@ -7,7 +7,7 @@ #include "iterator.h" static const int S_leaf_mask = - (1 << CMARK_NODE_HTML) | (1 << CMARK_NODE_HRULE) | + (1 << CMARK_NODE_HTML) | (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); diff --git a/src/latex.c b/src/latex.c index d87dfc0..0ae13cd 100644 --- a/src/latex.c +++ b/src/latex.c @@ -310,7 +310,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, CR(); break; - case CMARK_NODE_HRULE: + case CMARK_NODE_THEMATIC_BREAK: BLANKLINE(); LIT("\\begin{center}\\rule{0.5\\linewidth}{\\linethickness}\\end{center}"); BLANKLINE(); @@ -149,7 +149,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, CR(); break; - case CMARK_NODE_HRULE: + case CMARK_NODE_THEMATIC_BREAK: CR(); LIT(".PP\n * * * * *"); CR(); @@ -174,8 +174,8 @@ const char *cmark_node_get_type_string(cmark_node *node) { return "paragraph"; case CMARK_NODE_HEADING: return "heading"; - case CMARK_NODE_HRULE: - return "hrule"; + case CMARK_NODE_THEMATIC_BREAK: + return "thematic_break"; case CMARK_NODE_TEXT: return "text"; case CMARK_NODE_SOFTBREAK: diff --git a/src/scanners.c b/src/scanners.c index 2d5796f..91a7796 100644 --- a/src/scanners.c +++ b/src/scanners.c @@ -25495,10 +25495,10 @@ bufsize_t _scan_setext_heading_line(const unsigned char *p) { } } -// Scan a horizontal rule line: "...three or more hyphens, asterisks, +// Scan a thematic break line: "...three or more hyphens, asterisks, // or underscores on a line by themselves. If you wish, you may use // spaces between the hyphens or asterisks." -bufsize_t _scan_hrule(const unsigned char *p) { +bufsize_t _scan_thematic_break(const unsigned char *p) { const unsigned char *marker = NULL; const unsigned char *start = p; diff --git a/src/scanners.h b/src/scanners.h index 735aa5d..c2c03eb 100644 --- a/src/scanners.h +++ b/src/scanners.h @@ -23,7 +23,7 @@ bufsize_t _scan_link_title(const unsigned char *p); bufsize_t _scan_spacechars(const unsigned char *p); bufsize_t _scan_atx_heading_start(const unsigned char *p); bufsize_t _scan_setext_heading_line(const unsigned char *p); -bufsize_t _scan_hrule(const unsigned char *p); +bufsize_t _scan_thematic_break(const unsigned char *p); bufsize_t _scan_open_code_fence(const unsigned char *p); bufsize_t _scan_close_code_fence(const unsigned char *p); bufsize_t _scan_entity(const unsigned char *p); @@ -45,7 +45,7 @@ bufsize_t _scan_dangerous_url(const unsigned char *p); #define scan_spacechars(c, n) _scan_at(&_scan_spacechars, c, n) #define scan_atx_heading_start(c, n) _scan_at(&_scan_atx_heading_start, c, n) #define scan_setext_heading_line(c, n) _scan_at(&_scan_setext_heading_line, c, n) -#define scan_hrule(c, n) _scan_at(&_scan_hrule, c, n) +#define scan_thematic_break(c, n) _scan_at(&_scan_thematic_break, c, n) #define scan_open_code_fence(c, n) _scan_at(&_scan_open_code_fence, c, n) #define scan_close_code_fence(c, n) _scan_at(&_scan_close_code_fence, c, n) #define scan_entity(c, n) _scan_at(&_scan_entity, c, n) diff --git a/src/scanners.re b/src/scanners.re index ef2016b..61026f6 100644 --- a/src/scanners.re +++ b/src/scanners.re @@ -270,10 +270,10 @@ bufsize_t _scan_setext_heading_line(const unsigned char *p) */ } -// Scan a horizontal rule line: "...three or more hyphens, asterisks, +// Scan a thematic break line: "...three or more hyphens, asterisks, // or underscores on a line by themselves. If you wish, you may use // spaces between the hyphens or asterisks." -bufsize_t _scan_hrule(const unsigned char *p) +bufsize_t _scan_thematic_break(const unsigned char *p) { const unsigned char *marker = NULL; const unsigned char *start = p; |