commonmarker 0.23.7 → 0.23.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of commonmarker might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/ext/commonmarker/arena.c +1 -1
- data/ext/commonmarker/autolink.c +5 -0
- data/ext/commonmarker/cmark-gfm-core-extensions.h +11 -11
- data/ext/commonmarker/cmark-gfm.h +7 -2
- data/ext/commonmarker/cmark.c +3 -3
- data/ext/commonmarker/html.c +16 -2
- data/ext/commonmarker/node.c +14 -18
- data/ext/commonmarker/node.h +19 -13
- data/ext/commonmarker/table.c +1 -1
- data/lib/commonmarker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5720fe7353e4f737164cc06dd97f54d8e203342bcaf2267b77e26231122ef65
|
4
|
+
data.tar.gz: 1b929f138c087ce5da68ad0cdf61701ef0521db9e5d13c973b0ae81ea3c25bb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2867a5effac7f5a52f1f850e8c9f9f4257105e14fafd34ea5bb688bf98357aa15aece3e55cc8df27df219624493d41e34a715dba4f631b2618e294dee30e61a7
|
7
|
+
data.tar.gz: 938dfa5d2335d7ec2f9ee330b2d1c502c6c95809f8835ee1b6e1ba9c9bce13e5e73315f7add0feab39e229085266e416c8865f77b66731f915aeee78e87eb5ac
|
data/ext/commonmarker/arena.c
CHANGED
@@ -99,6 +99,6 @@ static void arena_free(void *ptr) {
|
|
99
99
|
|
100
100
|
cmark_mem CMARK_ARENA_MEM_ALLOCATOR = {arena_calloc, arena_realloc, arena_free};
|
101
101
|
|
102
|
-
cmark_mem *cmark_get_arena_mem_allocator() {
|
102
|
+
cmark_mem *cmark_get_arena_mem_allocator(void) {
|
103
103
|
return &CMARK_ARENA_MEM_ALLOCATOR;
|
104
104
|
}
|
data/ext/commonmarker/autolink.c
CHANGED
@@ -267,6 +267,11 @@ static cmark_node *url_match(cmark_parser *parser, cmark_node *parent,
|
|
267
267
|
cmark_node *text = cmark_node_new_with_mem(CMARK_NODE_TEXT, parser->mem);
|
268
268
|
text->as.literal = url;
|
269
269
|
cmark_node_append_child(node, text);
|
270
|
+
|
271
|
+
node->start_line = text->start_line = node->end_line = text->end_line = cmark_inline_parser_get_line(inline_parser);
|
272
|
+
|
273
|
+
node->start_column = text->start_column = max_rewind - rewind;
|
274
|
+
node->end_column = text->end_column = cmark_inline_parser_get_column(inline_parser) - 1;
|
270
275
|
|
271
276
|
return node;
|
272
277
|
}
|
@@ -6,45 +6,45 @@ extern "C" {
|
|
6
6
|
#endif
|
7
7
|
|
8
8
|
#include "cmark-gfm-extension_api.h"
|
9
|
-
#include "cmark-
|
10
|
-
#include
|
9
|
+
#include "cmark-gfm_export.h"
|
10
|
+
#include <stdbool.h>
|
11
11
|
#include <stdint.h>
|
12
12
|
|
13
|
-
|
13
|
+
CMARK_GFM_EXPORT
|
14
14
|
void cmark_gfm_core_extensions_ensure_registered(void);
|
15
15
|
|
16
|
-
|
16
|
+
CMARK_GFM_EXPORT
|
17
17
|
uint16_t cmark_gfm_extensions_get_table_columns(cmark_node *node);
|
18
18
|
|
19
19
|
/** Sets the number of columns for the table, returning 1 on success and 0 on error.
|
20
20
|
*/
|
21
|
-
|
21
|
+
CMARK_GFM_EXPORT
|
22
22
|
int cmark_gfm_extensions_set_table_columns(cmark_node *node, uint16_t n_columns);
|
23
23
|
|
24
|
-
|
24
|
+
CMARK_GFM_EXPORT
|
25
25
|
uint8_t *cmark_gfm_extensions_get_table_alignments(cmark_node *node);
|
26
26
|
|
27
27
|
/** Sets the alignments for the table, returning 1 on success and 0 on error.
|
28
28
|
*/
|
29
|
-
|
29
|
+
CMARK_GFM_EXPORT
|
30
30
|
int cmark_gfm_extensions_set_table_alignments(cmark_node *node, uint16_t ncols, uint8_t *alignments);
|
31
31
|
|
32
|
-
|
32
|
+
CMARK_GFM_EXPORT
|
33
33
|
int cmark_gfm_extensions_get_table_row_is_header(cmark_node *node);
|
34
34
|
|
35
35
|
/** Sets whether the node is a table header row, returning 1 on success and 0 on error.
|
36
36
|
*/
|
37
|
-
|
37
|
+
CMARK_GFM_EXPORT
|
38
38
|
int cmark_gfm_extensions_set_table_row_is_header(cmark_node *node, int is_header);
|
39
39
|
|
40
|
-
|
40
|
+
CMARK_GFM_EXPORT
|
41
41
|
bool cmark_gfm_extensions_get_tasklist_item_checked(cmark_node *node);
|
42
42
|
/* For backwards compatibility */
|
43
43
|
#define cmark_gfm_extensions_tasklist_is_checked cmark_gfm_extensions_get_tasklist_item_checked
|
44
44
|
|
45
45
|
/** Sets whether a tasklist item is "checked" (completed), returning 1 on success and 0 on error.
|
46
46
|
*/
|
47
|
-
|
47
|
+
CMARK_GFM_EXPORT
|
48
48
|
int cmark_gfm_extensions_set_tasklist_item_checked(cmark_node *node, bool is_checked);
|
49
49
|
|
50
50
|
#ifdef __cplusplus
|
@@ -111,13 +111,13 @@ typedef struct cmark_mem {
|
|
111
111
|
* realloc and free.
|
112
112
|
*/
|
113
113
|
CMARK_GFM_EXPORT
|
114
|
-
cmark_mem *cmark_get_default_mem_allocator();
|
114
|
+
cmark_mem *cmark_get_default_mem_allocator(void);
|
115
115
|
|
116
116
|
/** An arena allocator; uses system calloc to allocate large
|
117
117
|
* slabs of memory. Memory in these slabs is not reused at all.
|
118
118
|
*/
|
119
119
|
CMARK_GFM_EXPORT
|
120
|
-
cmark_mem *cmark_get_arena_mem_allocator();
|
120
|
+
cmark_mem *cmark_get_arena_mem_allocator(void);
|
121
121
|
|
122
122
|
/** Resets the arena allocator, quickly returning all used memory
|
123
123
|
* to the operating system.
|
@@ -225,6 +225,11 @@ CMARK_GFM_EXPORT cmark_node *cmark_node_first_child(cmark_node *node);
|
|
225
225
|
*/
|
226
226
|
CMARK_GFM_EXPORT cmark_node *cmark_node_last_child(cmark_node *node);
|
227
227
|
|
228
|
+
/** Returns the footnote reference of 'node', or NULL if 'node' doesn't have a
|
229
|
+
* footnote reference.
|
230
|
+
*/
|
231
|
+
CMARK_GFM_EXPORT cmark_node *cmark_node_parent_footnote_def(cmark_node *node);
|
232
|
+
|
228
233
|
/**
|
229
234
|
* ## Iterator
|
230
235
|
*
|
data/ext/commonmarker/cmark.c
CHANGED
@@ -10,9 +10,9 @@
|
|
10
10
|
cmark_node_type CMARK_NODE_LAST_BLOCK = CMARK_NODE_FOOTNOTE_DEFINITION;
|
11
11
|
cmark_node_type CMARK_NODE_LAST_INLINE = CMARK_NODE_FOOTNOTE_REFERENCE;
|
12
12
|
|
13
|
-
int cmark_version() { return CMARK_GFM_VERSION; }
|
13
|
+
int cmark_version(void) { return CMARK_GFM_VERSION; }
|
14
14
|
|
15
|
-
const char *cmark_version_string() { return CMARK_GFM_VERSION_STRING; }
|
15
|
+
const char *cmark_version_string(void) { return CMARK_GFM_VERSION_STRING; }
|
16
16
|
|
17
17
|
static void *xcalloc(size_t nmem, size_t size) {
|
18
18
|
void *ptr = calloc(nmem, size);
|
@@ -38,7 +38,7 @@ static void xfree(void *ptr) {
|
|
38
38
|
|
39
39
|
cmark_mem CMARK_DEFAULT_MEM_ALLOCATOR = {xcalloc, xrealloc, xfree};
|
40
40
|
|
41
|
-
cmark_mem *cmark_get_default_mem_allocator() {
|
41
|
+
cmark_mem *cmark_get_default_mem_allocator(void) {
|
42
42
|
return &CMARK_DEFAULT_MEM_ALLOCATOR;
|
43
43
|
}
|
44
44
|
|
data/ext/commonmarker/html.c
CHANGED
@@ -63,10 +63,16 @@ static bool S_put_footnote_backref(cmark_html_renderer *renderer, cmark_strbuf *
|
|
63
63
|
if (renderer->written_footnote_ix >= renderer->footnote_ix)
|
64
64
|
return false;
|
65
65
|
renderer->written_footnote_ix = renderer->footnote_ix;
|
66
|
+
char m[32];
|
67
|
+
snprintf(m, sizeof(m), "%d", renderer->written_footnote_ix);
|
66
68
|
|
67
69
|
cmark_strbuf_puts(html, "<a href=\"#fnref-");
|
68
70
|
houdini_escape_href(html, node->as.literal.data, node->as.literal.len);
|
69
|
-
cmark_strbuf_puts(html, "\" class=\"footnote-backref\" data-footnote-backref
|
71
|
+
cmark_strbuf_puts(html, "\" class=\"footnote-backref\" data-footnote-backref data-footnote-backref-idx=\"");
|
72
|
+
cmark_strbuf_puts(html, m);
|
73
|
+
cmark_strbuf_puts(html, "\" aria-label=\"Back to reference ");
|
74
|
+
cmark_strbuf_puts(html, m);
|
75
|
+
cmark_strbuf_puts(html, "\">↩</a>");
|
70
76
|
|
71
77
|
if (node->footnote.def_count > 1)
|
72
78
|
{
|
@@ -78,7 +84,15 @@ static bool S_put_footnote_backref(cmark_html_renderer *renderer, cmark_strbuf *
|
|
78
84
|
houdini_escape_href(html, node->as.literal.data, node->as.literal.len);
|
79
85
|
cmark_strbuf_puts(html, "-");
|
80
86
|
cmark_strbuf_puts(html, n);
|
81
|
-
cmark_strbuf_puts(html, "\" class=\"footnote-backref\" data-footnote-backref
|
87
|
+
cmark_strbuf_puts(html, "\" class=\"footnote-backref\" data-footnote-backref data-footnote-backref-idx=\"");
|
88
|
+
cmark_strbuf_puts(html, m);
|
89
|
+
cmark_strbuf_puts(html, "-");
|
90
|
+
cmark_strbuf_puts(html, n);
|
91
|
+
cmark_strbuf_puts(html, "\" aria-label=\"Back to reference ");
|
92
|
+
cmark_strbuf_puts(html, m);
|
93
|
+
cmark_strbuf_puts(html, "-");
|
94
|
+
cmark_strbuf_puts(html, n);
|
95
|
+
cmark_strbuf_puts(html, "\">↩<sup class=\"footnote-ref\">");
|
82
96
|
cmark_strbuf_puts(html, n);
|
83
97
|
cmark_strbuf_puts(html, "</sup></a>");
|
84
98
|
}
|
data/ext/commonmarker/node.c
CHANGED
@@ -9,12 +9,8 @@ static void S_node_unlink(cmark_node *node);
|
|
9
9
|
|
10
10
|
#define NODE_MEM(node) cmark_node_mem(node)
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
cmark_node__internal_flags CMARK_NODE__LAST_LINE_CHECKED;
|
15
|
-
|
16
|
-
void cmark_register_node_flag(cmark_node__internal_flags *flags) {
|
17
|
-
static uint8_t shift = 0;
|
12
|
+
void cmark_register_node_flag(cmark_node_internal_flags *flags) {
|
13
|
+
static cmark_node_internal_flags nextflag = CMARK_NODE__REGISTER_FIRST;
|
18
14
|
|
19
15
|
// flags should be a pointer to a global variable and this function
|
20
16
|
// should only be called once to initialize its value.
|
@@ -24,24 +20,16 @@ void cmark_register_node_flag(cmark_node__internal_flags *flags) {
|
|
24
20
|
}
|
25
21
|
|
26
22
|
// Check that we haven't run out of bits.
|
27
|
-
if (
|
23
|
+
if (nextflag == 0) {
|
28
24
|
fprintf(stderr, "too many flags in cmark_register_node_flag\n");
|
29
25
|
abort();
|
30
26
|
}
|
31
27
|
|
32
|
-
*flags =
|
33
|
-
|
28
|
+
*flags = nextflag;
|
29
|
+
nextflag <<= 1;
|
34
30
|
}
|
35
31
|
|
36
|
-
void cmark_init_standard_node_flags() {
|
37
|
-
static int initialized = 0;
|
38
|
-
if (!initialized) {
|
39
|
-
initialized = 1;
|
40
|
-
cmark_register_node_flag(&CMARK_NODE__OPEN);
|
41
|
-
cmark_register_node_flag(&CMARK_NODE__LAST_LINE_BLANK);
|
42
|
-
cmark_register_node_flag(&CMARK_NODE__LAST_LINE_CHECKED);
|
43
|
-
}
|
44
|
-
}
|
32
|
+
void cmark_init_standard_node_flags() {}
|
45
33
|
|
46
34
|
bool cmark_node_can_contain_type(cmark_node *node, cmark_node_type child_type) {
|
47
35
|
if (child_type == CMARK_NODE_DOCUMENT) {
|
@@ -335,6 +323,14 @@ cmark_node *cmark_node_last_child(cmark_node *node) {
|
|
335
323
|
}
|
336
324
|
}
|
337
325
|
|
326
|
+
cmark_node *cmark_node_parent_footnote_def(cmark_node *node) {
|
327
|
+
if (node == NULL) {
|
328
|
+
return NULL;
|
329
|
+
} else {
|
330
|
+
return node->parent_footnote_def;
|
331
|
+
}
|
332
|
+
}
|
333
|
+
|
338
334
|
void *cmark_node_get_user_data(cmark_node *node) {
|
339
335
|
if (node == NULL) {
|
340
336
|
return NULL;
|
data/ext/commonmarker/node.h
CHANGED
@@ -48,7 +48,17 @@ typedef struct {
|
|
48
48
|
cmark_chunk on_exit;
|
49
49
|
} cmark_custom;
|
50
50
|
|
51
|
-
|
51
|
+
enum cmark_node__internal_flags {
|
52
|
+
CMARK_NODE__OPEN = (1 << 0),
|
53
|
+
CMARK_NODE__LAST_LINE_BLANK = (1 << 1),
|
54
|
+
CMARK_NODE__LAST_LINE_CHECKED = (1 << 2),
|
55
|
+
|
56
|
+
// Extensions can register custom flags by calling `cmark_register_node_flag`.
|
57
|
+
// This is the starting value for the custom flags.
|
58
|
+
CMARK_NODE__REGISTER_FIRST = (1 << 3),
|
59
|
+
};
|
60
|
+
|
61
|
+
typedef uint16_t cmark_node_internal_flags;
|
52
62
|
|
53
63
|
struct cmark_node {
|
54
64
|
cmark_strbuf content;
|
@@ -68,7 +78,7 @@ struct cmark_node {
|
|
68
78
|
int end_column;
|
69
79
|
int internal_offset;
|
70
80
|
uint16_t type;
|
71
|
-
|
81
|
+
cmark_node_internal_flags flags;
|
72
82
|
|
73
83
|
cmark_syntax_extension *extension;
|
74
84
|
|
@@ -98,19 +108,15 @@ struct cmark_node {
|
|
98
108
|
* which will store the flag value.
|
99
109
|
*/
|
100
110
|
CMARK_GFM_EXPORT
|
101
|
-
void cmark_register_node_flag(
|
102
|
-
|
103
|
-
/**
|
104
|
-
* Standard node flags. (Initialized using `cmark_init_standard_node_flags`.)
|
105
|
-
*/
|
106
|
-
extern cmark_node__internal_flags CMARK_NODE__OPEN;
|
107
|
-
extern cmark_node__internal_flags CMARK_NODE__LAST_LINE_BLANK;
|
108
|
-
extern cmark_node__internal_flags CMARK_NODE__LAST_LINE_CHECKED;
|
111
|
+
void cmark_register_node_flag(cmark_node_internal_flags *flags);
|
109
112
|
|
110
113
|
/**
|
111
|
-
*
|
112
|
-
*
|
113
|
-
*
|
114
|
+
* DEPRECATED.
|
115
|
+
*
|
116
|
+
* This function was added in cmark-gfm version 0.29.0.gfm.7, and was
|
117
|
+
* required to be called at program start time, which caused
|
118
|
+
* backwards-compatibility issues in applications that use cmark-gfm as a
|
119
|
+
* library. It is now a no-op.
|
114
120
|
*/
|
115
121
|
CMARK_GFM_EXPORT
|
116
122
|
void cmark_init_standard_node_flags();
|
data/ext/commonmarker/table.c
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
#include "cmark-gfm-core-extensions.h"
|
13
13
|
|
14
14
|
// Custom node flag, initialized in `create_table_extension`.
|
15
|
-
static
|
15
|
+
static cmark_node_internal_flags CMARK_NODE__TABLE_VISITED;
|
16
16
|
|
17
17
|
cmark_node_type CMARK_NODE_TABLE, CMARK_NODE_TABLE_ROW,
|
18
18
|
CMARK_NODE_TABLE_CELL;
|
data/lib/commonmarker/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commonmarker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.23.
|
4
|
+
version: 0.23.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-01-
|
12
|
+
date: 2023-01-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: awesome_print
|