commonmarker 0.23.10 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/Cargo.lock +1182 -0
  3. data/Cargo.toml +7 -0
  4. data/README.md +217 -170
  5. data/ext/commonmarker/Cargo.toml +20 -0
  6. data/ext/commonmarker/extconf.rb +3 -6
  7. data/ext/commonmarker/src/lib.rs +103 -0
  8. data/ext/commonmarker/src/node.rs +1151 -0
  9. data/ext/commonmarker/src/options.rs +175 -0
  10. data/ext/commonmarker/src/plugins/syntax_highlighting.rs +166 -0
  11. data/ext/commonmarker/src/plugins.rs +6 -0
  12. data/ext/commonmarker/src/utils.rs +8 -0
  13. data/lib/commonmarker/config.rb +92 -40
  14. data/lib/commonmarker/constants.rb +7 -0
  15. data/lib/commonmarker/extension.rb +14 -0
  16. data/lib/commonmarker/node/ast.rb +8 -0
  17. data/lib/commonmarker/node/inspect.rb +14 -4
  18. data/lib/commonmarker/node.rb +29 -47
  19. data/lib/commonmarker/renderer.rb +1 -127
  20. data/lib/commonmarker/utils.rb +22 -0
  21. data/lib/commonmarker/version.rb +2 -2
  22. data/lib/commonmarker.rb +27 -25
  23. metadata +38 -186
  24. data/Rakefile +0 -109
  25. data/bin/commonmarker +0 -118
  26. data/commonmarker.gemspec +0 -38
  27. data/ext/commonmarker/arena.c +0 -104
  28. data/ext/commonmarker/autolink.c +0 -508
  29. data/ext/commonmarker/autolink.h +0 -8
  30. data/ext/commonmarker/blocks.c +0 -1622
  31. data/ext/commonmarker/buffer.c +0 -278
  32. data/ext/commonmarker/buffer.h +0 -116
  33. data/ext/commonmarker/case_fold_switch.inc +0 -4327
  34. data/ext/commonmarker/chunk.h +0 -135
  35. data/ext/commonmarker/cmark-gfm-core-extensions.h +0 -54
  36. data/ext/commonmarker/cmark-gfm-extension_api.h +0 -737
  37. data/ext/commonmarker/cmark-gfm-extensions_export.h +0 -42
  38. data/ext/commonmarker/cmark-gfm.h +0 -833
  39. data/ext/commonmarker/cmark-gfm_export.h +0 -42
  40. data/ext/commonmarker/cmark-gfm_version.h +0 -7
  41. data/ext/commonmarker/cmark.c +0 -55
  42. data/ext/commonmarker/cmark_ctype.c +0 -44
  43. data/ext/commonmarker/cmark_ctype.h +0 -33
  44. data/ext/commonmarker/commonmark.c +0 -514
  45. data/ext/commonmarker/commonmarker.c +0 -1308
  46. data/ext/commonmarker/commonmarker.h +0 -16
  47. data/ext/commonmarker/config.h +0 -76
  48. data/ext/commonmarker/core-extensions.c +0 -27
  49. data/ext/commonmarker/entities.inc +0 -2138
  50. data/ext/commonmarker/ext_scanners.c +0 -879
  51. data/ext/commonmarker/ext_scanners.h +0 -24
  52. data/ext/commonmarker/footnotes.c +0 -63
  53. data/ext/commonmarker/footnotes.h +0 -27
  54. data/ext/commonmarker/houdini.h +0 -57
  55. data/ext/commonmarker/houdini_href_e.c +0 -100
  56. data/ext/commonmarker/houdini_html_e.c +0 -66
  57. data/ext/commonmarker/houdini_html_u.c +0 -149
  58. data/ext/commonmarker/html.c +0 -502
  59. data/ext/commonmarker/html.h +0 -27
  60. data/ext/commonmarker/inlines.c +0 -1788
  61. data/ext/commonmarker/inlines.h +0 -29
  62. data/ext/commonmarker/iterator.c +0 -159
  63. data/ext/commonmarker/iterator.h +0 -26
  64. data/ext/commonmarker/latex.c +0 -468
  65. data/ext/commonmarker/linked_list.c +0 -37
  66. data/ext/commonmarker/man.c +0 -274
  67. data/ext/commonmarker/map.c +0 -129
  68. data/ext/commonmarker/map.h +0 -44
  69. data/ext/commonmarker/node.c +0 -1045
  70. data/ext/commonmarker/node.h +0 -167
  71. data/ext/commonmarker/parser.h +0 -59
  72. data/ext/commonmarker/plaintext.c +0 -218
  73. data/ext/commonmarker/plugin.c +0 -36
  74. data/ext/commonmarker/plugin.h +0 -34
  75. data/ext/commonmarker/references.c +0 -43
  76. data/ext/commonmarker/references.h +0 -26
  77. data/ext/commonmarker/registry.c +0 -63
  78. data/ext/commonmarker/registry.h +0 -24
  79. data/ext/commonmarker/render.c +0 -213
  80. data/ext/commonmarker/render.h +0 -62
  81. data/ext/commonmarker/scanners.c +0 -14056
  82. data/ext/commonmarker/scanners.h +0 -70
  83. data/ext/commonmarker/scanners.re +0 -341
  84. data/ext/commonmarker/strikethrough.c +0 -167
  85. data/ext/commonmarker/strikethrough.h +0 -9
  86. data/ext/commonmarker/syntax_extension.c +0 -149
  87. data/ext/commonmarker/syntax_extension.h +0 -34
  88. data/ext/commonmarker/table.c +0 -917
  89. data/ext/commonmarker/table.h +0 -12
  90. data/ext/commonmarker/tagfilter.c +0 -60
  91. data/ext/commonmarker/tagfilter.h +0 -8
  92. data/ext/commonmarker/tasklist.c +0 -156
  93. data/ext/commonmarker/tasklist.h +0 -8
  94. data/ext/commonmarker/utf8.c +0 -317
  95. data/ext/commonmarker/utf8.h +0 -35
  96. data/ext/commonmarker/xml.c +0 -182
  97. data/lib/commonmarker/renderer/html_renderer.rb +0 -256
@@ -1,149 +0,0 @@
1
- #include <stdlib.h>
2
- #include <assert.h>
3
-
4
- #include "cmark-gfm.h"
5
- #include "syntax_extension.h"
6
- #include "buffer.h"
7
-
8
- extern cmark_mem CMARK_DEFAULT_MEM_ALLOCATOR;
9
-
10
- static cmark_mem *_mem = &CMARK_DEFAULT_MEM_ALLOCATOR;
11
-
12
- void cmark_syntax_extension_free(cmark_mem *mem, cmark_syntax_extension *extension) {
13
- if (extension->free_function && extension->priv) {
14
- extension->free_function(mem, extension->priv);
15
- }
16
-
17
- cmark_llist_free(mem, extension->special_inline_chars);
18
- mem->free(extension->name);
19
- mem->free(extension);
20
- }
21
-
22
- cmark_syntax_extension *cmark_syntax_extension_new(const char *name) {
23
- cmark_syntax_extension *res = (cmark_syntax_extension *) _mem->calloc(1, sizeof(cmark_syntax_extension));
24
- res->name = (char *) _mem->calloc(1, sizeof(char) * (strlen(name)) + 1);
25
- strcpy(res->name, name);
26
- return res;
27
- }
28
-
29
- cmark_node_type cmark_syntax_extension_add_node(int is_inline) {
30
- cmark_node_type *ref = !is_inline ? &CMARK_NODE_LAST_BLOCK : &CMARK_NODE_LAST_INLINE;
31
-
32
- if ((*ref & CMARK_NODE_VALUE_MASK) == CMARK_NODE_VALUE_MASK) {
33
- assert(false);
34
- return (cmark_node_type) 0;
35
- }
36
-
37
- return *ref = (cmark_node_type) ((int) *ref + 1);
38
- }
39
-
40
- void cmark_syntax_extension_set_emphasis(cmark_syntax_extension *extension,
41
- int emphasis) {
42
- extension->emphasis = emphasis == 1;
43
- }
44
-
45
- void cmark_syntax_extension_set_open_block_func(cmark_syntax_extension *extension,
46
- cmark_open_block_func func) {
47
- extension->try_opening_block = func;
48
- }
49
-
50
- void cmark_syntax_extension_set_match_block_func(cmark_syntax_extension *extension,
51
- cmark_match_block_func func) {
52
- extension->last_block_matches = func;
53
- }
54
-
55
- void cmark_syntax_extension_set_match_inline_func(cmark_syntax_extension *extension,
56
- cmark_match_inline_func func) {
57
- extension->match_inline = func;
58
- }
59
-
60
- void cmark_syntax_extension_set_inline_from_delim_func(cmark_syntax_extension *extension,
61
- cmark_inline_from_delim_func func) {
62
- extension->insert_inline_from_delim = func;
63
- }
64
-
65
- void cmark_syntax_extension_set_special_inline_chars(cmark_syntax_extension *extension,
66
- cmark_llist *special_chars) {
67
- extension->special_inline_chars = special_chars;
68
- }
69
-
70
- void cmark_syntax_extension_set_get_type_string_func(cmark_syntax_extension *extension,
71
- cmark_get_type_string_func func) {
72
- extension->get_type_string_func = func;
73
- }
74
-
75
- void cmark_syntax_extension_set_can_contain_func(cmark_syntax_extension *extension,
76
- cmark_can_contain_func func) {
77
- extension->can_contain_func = func;
78
- }
79
-
80
- void cmark_syntax_extension_set_contains_inlines_func(cmark_syntax_extension *extension,
81
- cmark_contains_inlines_func func) {
82
- extension->contains_inlines_func = func;
83
- }
84
-
85
- void cmark_syntax_extension_set_commonmark_render_func(cmark_syntax_extension *extension,
86
- cmark_common_render_func func) {
87
- extension->commonmark_render_func = func;
88
- }
89
-
90
- void cmark_syntax_extension_set_plaintext_render_func(cmark_syntax_extension *extension,
91
- cmark_common_render_func func) {
92
- extension->plaintext_render_func = func;
93
- }
94
-
95
- void cmark_syntax_extension_set_latex_render_func(cmark_syntax_extension *extension,
96
- cmark_common_render_func func) {
97
- extension->latex_render_func = func;
98
- }
99
-
100
- void cmark_syntax_extension_set_xml_attr_func(cmark_syntax_extension *extension,
101
- cmark_xml_attr_func func) {
102
- extension->xml_attr_func = func;
103
- }
104
-
105
- void cmark_syntax_extension_set_man_render_func(cmark_syntax_extension *extension,
106
- cmark_common_render_func func) {
107
- extension->man_render_func = func;
108
- }
109
-
110
- void cmark_syntax_extension_set_html_render_func(cmark_syntax_extension *extension,
111
- cmark_html_render_func func) {
112
- extension->html_render_func = func;
113
- }
114
-
115
- void cmark_syntax_extension_set_html_filter_func(cmark_syntax_extension *extension,
116
- cmark_html_filter_func func) {
117
- extension->html_filter_func = func;
118
- }
119
-
120
- void cmark_syntax_extension_set_postprocess_func(cmark_syntax_extension *extension,
121
- cmark_postprocess_func func) {
122
- extension->postprocess_func = func;
123
- }
124
-
125
- void cmark_syntax_extension_set_private(cmark_syntax_extension *extension,
126
- void *priv,
127
- cmark_free_func free_func) {
128
- extension->priv = priv;
129
- extension->free_function = free_func;
130
- }
131
-
132
- void *cmark_syntax_extension_get_private(cmark_syntax_extension *extension) {
133
- return extension->priv;
134
- }
135
-
136
- void cmark_syntax_extension_set_opaque_alloc_func(cmark_syntax_extension *extension,
137
- cmark_opaque_alloc_func func) {
138
- extension->opaque_alloc_func = func;
139
- }
140
-
141
- void cmark_syntax_extension_set_opaque_free_func(cmark_syntax_extension *extension,
142
- cmark_opaque_free_func func) {
143
- extension->opaque_free_func = func;
144
- }
145
-
146
- void cmark_syntax_extension_set_commonmark_escape_func(cmark_syntax_extension *extension,
147
- cmark_commonmark_escape_func func) {
148
- extension->commonmark_escape_func = func;
149
- }
@@ -1,34 +0,0 @@
1
- #ifndef CMARK_SYNTAX_EXTENSION_H
2
- #define CMARK_SYNTAX_EXTENSION_H
3
-
4
- #include "cmark-gfm.h"
5
- #include "cmark-gfm-extension_api.h"
6
- #include "config.h"
7
-
8
- struct cmark_syntax_extension {
9
- cmark_match_block_func last_block_matches;
10
- cmark_open_block_func try_opening_block;
11
- cmark_match_inline_func match_inline;
12
- cmark_inline_from_delim_func insert_inline_from_delim;
13
- cmark_llist * special_inline_chars;
14
- char * name;
15
- void * priv;
16
- bool emphasis;
17
- cmark_free_func free_function;
18
- cmark_get_type_string_func get_type_string_func;
19
- cmark_can_contain_func can_contain_func;
20
- cmark_contains_inlines_func contains_inlines_func;
21
- cmark_common_render_func commonmark_render_func;
22
- cmark_common_render_func plaintext_render_func;
23
- cmark_common_render_func latex_render_func;
24
- cmark_xml_attr_func xml_attr_func;
25
- cmark_common_render_func man_render_func;
26
- cmark_html_render_func html_render_func;
27
- cmark_html_filter_func html_filter_func;
28
- cmark_postprocess_func postprocess_func;
29
- cmark_opaque_alloc_func opaque_alloc_func;
30
- cmark_opaque_free_func opaque_free_func;
31
- cmark_commonmark_escape_func commonmark_escape_func;
32
- };
33
-
34
- #endif