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.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/conduct.md +133 -0
  4. data/ext/markly/Makefile +270 -0
  5. data/ext/markly/arena.c +9 -8
  6. data/ext/markly/arena.o +0 -0
  7. data/ext/markly/autolink.c +217 -134
  8. data/ext/markly/autolink.o +0 -0
  9. data/ext/markly/blocks.c +27 -2
  10. data/ext/markly/blocks.o +0 -0
  11. data/ext/markly/buffer.o +0 -0
  12. data/ext/markly/cmark-gfm-core-extensions.h +11 -11
  13. data/ext/markly/cmark-gfm-extension_api.h +1 -0
  14. data/ext/markly/cmark-gfm.h +18 -2
  15. data/ext/markly/cmark.c +3 -3
  16. data/ext/markly/cmark.o +0 -0
  17. data/ext/markly/cmark_ctype.o +0 -0
  18. data/ext/markly/commonmark.c +19 -34
  19. data/ext/markly/commonmark.o +0 -0
  20. data/ext/markly/core-extensions.o +0 -0
  21. data/ext/markly/ext_scanners.o +0 -0
  22. data/ext/markly/extconf.rb +8 -1
  23. data/ext/markly/footnotes.o +0 -0
  24. data/ext/markly/houdini_href_e.o +0 -0
  25. data/ext/markly/houdini_html_e.o +0 -0
  26. data/ext/markly/houdini_html_u.o +0 -0
  27. data/ext/markly/html.c +22 -6
  28. data/ext/markly/html.o +0 -0
  29. data/ext/markly/inlines.c +148 -51
  30. data/ext/markly/inlines.o +0 -0
  31. data/ext/markly/iterator.o +0 -0
  32. data/ext/markly/latex.c +6 -4
  33. data/ext/markly/latex.o +0 -0
  34. data/ext/markly/linked_list.o +0 -0
  35. data/ext/markly/man.c +7 -11
  36. data/ext/markly/man.o +0 -0
  37. data/ext/markly/map.c +11 -4
  38. data/ext/markly/map.h +5 -2
  39. data/ext/markly/map.o +0 -0
  40. data/ext/markly/markly.bundle +0 -0
  41. data/ext/markly/markly.c +582 -586
  42. data/ext/markly/markly.h +1 -1
  43. data/ext/markly/markly.o +0 -0
  44. data/ext/markly/node.c +76 -10
  45. data/ext/markly/node.h +42 -1
  46. data/ext/markly/node.o +0 -0
  47. data/ext/markly/parser.h +1 -0
  48. data/ext/markly/plaintext.c +12 -29
  49. data/ext/markly/plaintext.o +0 -0
  50. data/ext/markly/plugin.o +0 -0
  51. data/ext/markly/references.c +1 -0
  52. data/ext/markly/references.o +0 -0
  53. data/ext/markly/registry.o +0 -0
  54. data/ext/markly/render.c +15 -7
  55. data/ext/markly/render.o +0 -0
  56. data/ext/markly/scanners.c +13916 -10380
  57. data/ext/markly/scanners.h +8 -0
  58. data/ext/markly/scanners.o +0 -0
  59. data/ext/markly/scanners.re +47 -8
  60. data/ext/markly/strikethrough.c +1 -1
  61. data/ext/markly/strikethrough.o +0 -0
  62. data/ext/markly/syntax_extension.o +0 -0
  63. data/ext/markly/table.c +81 -31
  64. data/ext/markly/table.o +0 -0
  65. data/ext/markly/tagfilter.o +0 -0
  66. data/ext/markly/tasklist.o +0 -0
  67. data/ext/markly/utf8.o +0 -0
  68. data/ext/markly/xml.c +2 -1
  69. data/ext/markly/xml.o +0 -0
  70. data/lib/markly/flags.rb +16 -0
  71. data/lib/markly/node/inspect.rb +59 -53
  72. data/lib/markly/node.rb +125 -58
  73. data/lib/markly/renderer/generic.rb +129 -124
  74. data/lib/markly/renderer/html.rb +294 -275
  75. data/lib/markly/version.rb +7 -1
  76. data/lib/markly.rb +36 -30
  77. data/license.md +39 -0
  78. data/readme.md +36 -0
  79. data.tar.gz.sig +0 -0
  80. metadata +98 -29
  81. metadata.gz.sig +0 -0
  82. data/bin/markly +0 -94
  83. 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
- unsigned int i = 0, last = 0, size = map->size;
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 (!ref)
95
- return NULL;
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 ref[0];
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
- unsigned int age;
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
- unsigned int size;
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