markly 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/conduct.md +133 -0
- data/ext/markly/Makefile +270 -0
- data/ext/markly/arena.c +9 -8
- data/ext/markly/arena.o +0 -0
- data/ext/markly/autolink.c +217 -134
- data/ext/markly/autolink.o +0 -0
- data/ext/markly/blocks.c +27 -2
- data/ext/markly/blocks.o +0 -0
- data/ext/markly/buffer.o +0 -0
- data/ext/markly/cmark-gfm-core-extensions.h +11 -11
- data/ext/markly/cmark-gfm-extension_api.h +1 -0
- data/ext/markly/cmark-gfm.h +18 -2
- data/ext/markly/cmark.c +3 -3
- data/ext/markly/cmark.o +0 -0
- data/ext/markly/cmark_ctype.o +0 -0
- data/ext/markly/commonmark.c +19 -34
- data/ext/markly/commonmark.o +0 -0
- data/ext/markly/core-extensions.o +0 -0
- data/ext/markly/ext_scanners.o +0 -0
- data/ext/markly/extconf.rb +8 -1
- data/ext/markly/footnotes.o +0 -0
- data/ext/markly/houdini_href_e.o +0 -0
- data/ext/markly/houdini_html_e.o +0 -0
- data/ext/markly/houdini_html_u.o +0 -0
- data/ext/markly/html.c +22 -6
- data/ext/markly/html.o +0 -0
- data/ext/markly/inlines.c +148 -51
- data/ext/markly/inlines.o +0 -0
- data/ext/markly/iterator.o +0 -0
- data/ext/markly/latex.c +6 -4
- data/ext/markly/latex.o +0 -0
- data/ext/markly/linked_list.o +0 -0
- data/ext/markly/man.c +7 -11
- data/ext/markly/man.o +0 -0
- data/ext/markly/map.c +11 -4
- data/ext/markly/map.h +5 -2
- data/ext/markly/map.o +0 -0
- data/ext/markly/markly.bundle +0 -0
- data/ext/markly/markly.c +582 -586
- data/ext/markly/markly.h +1 -1
- data/ext/markly/markly.o +0 -0
- data/ext/markly/node.c +76 -10
- data/ext/markly/node.h +42 -1
- data/ext/markly/node.o +0 -0
- data/ext/markly/parser.h +1 -0
- data/ext/markly/plaintext.c +12 -29
- data/ext/markly/plaintext.o +0 -0
- data/ext/markly/plugin.o +0 -0
- data/ext/markly/references.c +1 -0
- data/ext/markly/references.o +0 -0
- data/ext/markly/registry.o +0 -0
- data/ext/markly/render.c +15 -7
- data/ext/markly/render.o +0 -0
- data/ext/markly/scanners.c +13916 -10380
- data/ext/markly/scanners.h +8 -0
- data/ext/markly/scanners.o +0 -0
- data/ext/markly/scanners.re +47 -8
- data/ext/markly/strikethrough.c +1 -1
- data/ext/markly/strikethrough.o +0 -0
- data/ext/markly/syntax_extension.o +0 -0
- data/ext/markly/table.c +81 -31
- data/ext/markly/table.o +0 -0
- data/ext/markly/tagfilter.o +0 -0
- data/ext/markly/tasklist.o +0 -0
- data/ext/markly/utf8.o +0 -0
- data/ext/markly/xml.c +2 -1
- data/ext/markly/xml.o +0 -0
- data/lib/markly/flags.rb +16 -0
- data/lib/markly/node/inspect.rb +59 -53
- data/lib/markly/node.rb +125 -58
- data/lib/markly/renderer/generic.rb +129 -124
- data/lib/markly/renderer/html.rb +294 -275
- data/lib/markly/version.rb +7 -1
- data/lib/markly.rb +36 -30
- data/license.md +39 -0
- data/readme.md +36 -0
- data.tar.gz.sig +0 -0
- metadata +98 -29
- metadata.gz.sig +0 -0
- data/bin/markly +0 -94
- data/lib/markly/markly.bundle +0 -0
data/ext/markly/map.c
CHANGED
@@ -51,7 +51,7 @@ refsearch(const void *label, const void *p2) {
|
|
51
51
|
}
|
52
52
|
|
53
53
|
static void sort_map(cmark_map *map) {
|
54
|
-
|
54
|
+
size_t i = 0, last = 0, size = map->size;
|
55
55
|
cmark_map_entry *r = map->refs, **sorted = NULL;
|
56
56
|
|
57
57
|
sorted = (cmark_map_entry **)map->mem->calloc(size, sizeof(cmark_map_entry *));
|
@@ -73,6 +73,7 @@ static void sort_map(cmark_map *map) {
|
|
73
73
|
|
74
74
|
cmark_map_entry *cmark_map_lookup(cmark_map *map, cmark_chunk *label) {
|
75
75
|
cmark_map_entry **ref = NULL;
|
76
|
+
cmark_map_entry *r = NULL;
|
76
77
|
unsigned char *norm;
|
77
78
|
|
78
79
|
if (label->len < 1 || label->len > MAX_LINK_LABEL_LENGTH)
|
@@ -91,10 +92,15 @@ cmark_map_entry *cmark_map_lookup(cmark_map *map, cmark_chunk *label) {
|
|
91
92
|
ref = (cmark_map_entry **)bsearch(norm, map->sorted, map->size, sizeof(cmark_map_entry *), refsearch);
|
92
93
|
map->mem->free(norm);
|
93
94
|
|
94
|
-
if (
|
95
|
-
|
95
|
+
if (ref != NULL) {
|
96
|
+
r = ref[0];
|
97
|
+
/* Check for expansion limit */
|
98
|
+
if (r->size > map->max_ref_size - map->ref_size)
|
99
|
+
return NULL;
|
100
|
+
map->ref_size += r->size;
|
101
|
+
}
|
96
102
|
|
97
|
-
return
|
103
|
+
return r;
|
98
104
|
}
|
99
105
|
|
100
106
|
void cmark_map_free(cmark_map *map) {
|
@@ -118,5 +124,6 @@ cmark_map *cmark_map_new(cmark_mem *mem, cmark_map_free_f free) {
|
|
118
124
|
cmark_map *map = (cmark_map *)mem->calloc(1, sizeof(cmark_map));
|
119
125
|
map->mem = mem;
|
120
126
|
map->free = free;
|
127
|
+
map->max_ref_size = UINT_MAX;
|
121
128
|
return map;
|
122
129
|
}
|
data/ext/markly/map.h
CHANGED
@@ -10,7 +10,8 @@ extern "C" {
|
|
10
10
|
struct cmark_map_entry {
|
11
11
|
struct cmark_map_entry *next;
|
12
12
|
unsigned char *label;
|
13
|
-
|
13
|
+
size_t age;
|
14
|
+
size_t size;
|
14
15
|
};
|
15
16
|
|
16
17
|
typedef struct cmark_map_entry cmark_map_entry;
|
@@ -23,7 +24,9 @@ struct cmark_map {
|
|
23
24
|
cmark_mem *mem;
|
24
25
|
cmark_map_entry *refs;
|
25
26
|
cmark_map_entry **sorted;
|
26
|
-
|
27
|
+
size_t size;
|
28
|
+
size_t ref_size;
|
29
|
+
size_t max_ref_size;
|
27
30
|
cmark_map_free_f free;
|
28
31
|
};
|
29
32
|
|
data/ext/markly/map.o
ADDED
Binary file
|
Binary file
|