commonmarker 0.3.0 → 0.4.0

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.

Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/ext/commonmarker/cmark/CMakeLists.txt +10 -4
  3. data/ext/commonmarker/cmark/Makefile +5 -5
  4. data/ext/commonmarker/cmark/api_test/CMakeLists.txt +1 -1
  5. data/ext/commonmarker/cmark/api_test/main.c +16 -0
  6. data/ext/commonmarker/cmark/build/CMakeCache.txt +3 -4
  7. data/ext/commonmarker/cmark/build/CMakeFiles/2.8.10.1/CMakeSystem.cmake +4 -4
  8. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeError.log +12 -12
  9. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeOutput.log +97 -142
  10. data/ext/commonmarker/cmark/build/CMakeFiles/Makefile.cmake +0 -1
  11. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/build.make +1 -1
  12. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/link.txt +1 -1
  13. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/DependInfo.cmake +1 -1
  14. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/build.make +23 -23
  15. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/cmake_clean.cmake +2 -2
  16. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/link.txt +1 -1
  17. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/blocks.c.o +0 -0
  18. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/buffer.c.o +0 -0
  19. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmark.c.o +0 -0
  20. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/commonmark.c.o +0 -0
  21. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/houdini_html_u.c.o +0 -0
  22. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/html.c.o +0 -0
  23. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/inlines.c.o +0 -0
  24. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/node.c.o +0 -0
  25. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/references.c.o +0 -0
  26. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/render.c.o +0 -0
  27. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/scanners.c.o +0 -0
  28. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/utf8.c.o +0 -0
  29. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/xml.c.o +0 -0
  30. data/ext/commonmarker/cmark/build/src/cmake_install.cmake +3 -3
  31. data/ext/commonmarker/cmark/build/src/cmark_version.h +2 -2
  32. data/ext/commonmarker/cmark/build/src/config.h +6 -6
  33. data/ext/commonmarker/cmark/build/src/libcmark.a +0 -0
  34. data/ext/commonmarker/cmark/build/src/libcmark.pc +1 -1
  35. data/ext/commonmarker/cmark/build/testdir/CTestTestfile.cmake +4 -4
  36. data/ext/commonmarker/cmark/changelog.txt +46 -0
  37. data/ext/commonmarker/cmark/man/man3/cmark.3 +21 -20
  38. data/ext/commonmarker/cmark/src/CMakeLists.txt +4 -6
  39. data/ext/commonmarker/cmark/src/bench.h +8 -8
  40. data/ext/commonmarker/cmark/src/blocks.c +917 -947
  41. data/ext/commonmarker/cmark/src/buffer.c +213 -288
  42. data/ext/commonmarker/cmark/src/buffer.h +19 -21
  43. data/ext/commonmarker/cmark/src/chunk.h +78 -82
  44. data/ext/commonmarker/cmark/src/cmark.c +9 -17
  45. data/ext/commonmarker/cmark/src/cmark.h +113 -157
  46. data/ext/commonmarker/cmark/src/cmark_ctype.c +24 -35
  47. data/ext/commonmarker/cmark/src/commonmark.c +390 -425
  48. data/ext/commonmarker/cmark/src/config.h.in +6 -6
  49. data/ext/commonmarker/cmark/src/houdini.h +21 -15
  50. data/ext/commonmarker/cmark/src/houdini_href_e.c +50 -57
  51. data/ext/commonmarker/cmark/src/houdini_html_e.c +36 -51
  52. data/ext/commonmarker/cmark/src/houdini_html_u.c +119 -124
  53. data/ext/commonmarker/cmark/src/html.c +289 -307
  54. data/ext/commonmarker/cmark/src/inlines.c +976 -1030
  55. data/ext/commonmarker/cmark/src/inlines.h +4 -2
  56. data/ext/commonmarker/cmark/src/iterator.c +96 -126
  57. data/ext/commonmarker/cmark/src/iterator.h +5 -5
  58. data/ext/commonmarker/cmark/src/latex.c +379 -401
  59. data/ext/commonmarker/cmark/src/main.c +168 -175
  60. data/ext/commonmarker/cmark/src/man.c +212 -226
  61. data/ext/commonmarker/cmark/src/node.c +746 -839
  62. data/ext/commonmarker/cmark/src/node.h +47 -48
  63. data/ext/commonmarker/cmark/src/parser.h +14 -14
  64. data/ext/commonmarker/cmark/src/references.c +101 -111
  65. data/ext/commonmarker/cmark/src/references.h +10 -8
  66. data/ext/commonmarker/cmark/src/render.c +144 -167
  67. data/ext/commonmarker/cmark/src/render.h +22 -41
  68. data/ext/commonmarker/cmark/src/scanners.c +27695 -20903
  69. data/ext/commonmarker/cmark/src/scanners.h +2 -1
  70. data/ext/commonmarker/cmark/src/scanners.re +1 -1
  71. data/ext/commonmarker/cmark/src/utf8.c +276 -419
  72. data/ext/commonmarker/cmark/src/utf8.h +6 -6
  73. data/ext/commonmarker/cmark/src/xml.c +129 -144
  74. data/ext/commonmarker/cmark/test/CMakeLists.txt +4 -4
  75. data/ext/commonmarker/cmark/test/smart_punct.txt +8 -0
  76. data/ext/commonmarker/cmark/test/spec.txt +109 -47
  77. data/lib/commonmarker/version.rb +1 -1
  78. metadata +2 -2
@@ -7,115 +7,111 @@
7
7
  #include "cmark_ctype.h"
8
8
  #include "buffer.h"
9
9
 
10
- #define CMARK_CHUNK_EMPTY { NULL, 0, 0 }
10
+ #define CMARK_CHUNK_EMPTY \
11
+ { NULL, 0, 0 }
11
12
 
12
13
  typedef struct {
13
- unsigned char *data;
14
- bufsize_t len;
15
- bufsize_t alloc; // also implies a NULL-terminated string
14
+ unsigned char *data;
15
+ bufsize_t len;
16
+ bufsize_t alloc; // also implies a NULL-terminated string
16
17
  } cmark_chunk;
17
18
 
18
- static inline void cmark_chunk_free(cmark_chunk *c)
19
- {
20
- if (c->alloc)
21
- free(c->data);
19
+ static CMARK_INLINE void cmark_chunk_free(cmark_chunk *c) {
20
+ if (c->alloc)
21
+ free(c->data);
22
22
 
23
- c->data = NULL;
24
- c->alloc = 0;
25
- c->len = 0;
23
+ c->data = NULL;
24
+ c->alloc = 0;
25
+ c->len = 0;
26
26
  }
27
27
 
28
- static inline void cmark_chunk_ltrim(cmark_chunk *c)
29
- {
30
- assert(!c->alloc);
28
+ static CMARK_INLINE void cmark_chunk_ltrim(cmark_chunk *c) {
29
+ assert(!c->alloc);
31
30
 
32
- while (c->len && cmark_isspace(c->data[0])) {
33
- c->data++;
34
- c->len--;
35
- }
31
+ while (c->len && cmark_isspace(c->data[0])) {
32
+ c->data++;
33
+ c->len--;
34
+ }
36
35
  }
37
36
 
38
- static inline void cmark_chunk_rtrim(cmark_chunk *c)
39
- {
40
- while (c->len > 0) {
41
- if (!cmark_isspace(c->data[c->len - 1]))
42
- break;
37
+ static CMARK_INLINE void cmark_chunk_rtrim(cmark_chunk *c) {
38
+ while (c->len > 0) {
39
+ if (!cmark_isspace(c->data[c->len - 1]))
40
+ break;
43
41
 
44
- c->len--;
45
- }
42
+ c->len--;
43
+ }
46
44
  }
47
45
 
48
- static inline void cmark_chunk_trim(cmark_chunk *c)
49
- {
50
- cmark_chunk_ltrim(c);
51
- cmark_chunk_rtrim(c);
46
+ static CMARK_INLINE void cmark_chunk_trim(cmark_chunk *c) {
47
+ cmark_chunk_ltrim(c);
48
+ cmark_chunk_rtrim(c);
52
49
  }
53
50
 
54
- static inline bufsize_t cmark_chunk_strchr(cmark_chunk *ch, int c, bufsize_t offset)
55
- {
56
- const unsigned char *p = (unsigned char *)memchr(ch->data + offset, c, ch->len - offset);
57
- return p ? (bufsize_t)(p - ch->data) : ch->len;
51
+ static CMARK_INLINE bufsize_t cmark_chunk_strchr(cmark_chunk *ch, int c,
52
+ bufsize_t offset) {
53
+ const unsigned char *p =
54
+ (unsigned char *)memchr(ch->data + offset, c, ch->len - offset);
55
+ return p ? (bufsize_t)(p - ch->data) : ch->len;
58
56
  }
59
57
 
60
- static inline const char *cmark_chunk_to_cstr(cmark_chunk *c)
61
- {
62
- unsigned char *str;
63
-
64
- if (c->alloc) {
65
- return (char *)c->data;
66
- }
67
- str = (unsigned char *)malloc(c->len + 1);
68
- if(str != NULL) {
69
- if(c->len > 0) {
70
- memcpy(str, c->data, c->len);
71
- }
72
- str[c->len] = 0;
73
- }
74
- c->data = str;
75
- c->alloc = 1;
76
-
77
- return (char *)str;
58
+ static CMARK_INLINE const char *cmark_chunk_to_cstr(cmark_chunk *c) {
59
+ unsigned char *str;
60
+
61
+ if (c->alloc) {
62
+ return (char *)c->data;
63
+ }
64
+ str = (unsigned char *)malloc(c->len + 1);
65
+ if (str != NULL) {
66
+ if (c->len > 0) {
67
+ memcpy(str, c->data, c->len);
68
+ }
69
+ str[c->len] = 0;
70
+ }
71
+ c->data = str;
72
+ c->alloc = 1;
73
+
74
+ return (char *)str;
78
75
  }
79
76
 
80
- static inline void cmark_chunk_set_cstr(cmark_chunk *c, const char *str)
81
- {
82
- if (c->alloc) {
83
- free(c->data);
84
- }
85
- if (str == NULL) {
86
- c->len = 0;
87
- c->data = NULL;
88
- c->alloc = 0;
89
- } else {
90
- c->len = cmark_strbuf_safe_strlen(str);
91
- c->data = (unsigned char *)malloc(c->len + 1);
92
- c->alloc = 1;
93
- memcpy(c->data, str, c->len + 1);
94
- }
77
+ static CMARK_INLINE void
78
+ cmark_chunk_set_cstr(cmark_chunk *c, const char *str) {
79
+ if (c->alloc) {
80
+ free(c->data);
81
+ }
82
+ if (str == NULL) {
83
+ c->len = 0;
84
+ c->data = NULL;
85
+ c->alloc = 0;
86
+ } else {
87
+ c->len = cmark_strbuf_safe_strlen(str);
88
+ c->data = (unsigned char *)malloc(c->len + 1);
89
+ c->alloc = 1;
90
+ memcpy(c->data, str, c->len + 1);
91
+ }
95
92
  }
96
93
 
97
- static inline cmark_chunk cmark_chunk_literal(const char *data)
98
- {
99
- bufsize_t len = data ? cmark_strbuf_safe_strlen(data) : 0;
100
- cmark_chunk c = {(unsigned char *)data, len, 0};
101
- return c;
94
+ static CMARK_INLINE cmark_chunk cmark_chunk_literal(const char *data) {
95
+ bufsize_t len = data ? cmark_strbuf_safe_strlen(data) : 0;
96
+ cmark_chunk c = {(unsigned char *)data, len, 0};
97
+ return c;
102
98
  }
103
99
 
104
- static inline cmark_chunk cmark_chunk_dup(const cmark_chunk *ch, bufsize_t pos, bufsize_t len)
105
- {
106
- cmark_chunk c = {ch->data + pos, len, 0};
107
- return c;
100
+ static CMARK_INLINE
101
+ cmark_chunk cmark_chunk_dup(const cmark_chunk *ch, bufsize_t pos,
102
+ bufsize_t len) {
103
+ cmark_chunk c = {ch->data + pos, len, 0};
104
+ return c;
108
105
  }
109
106
 
110
- static inline cmark_chunk cmark_chunk_buf_detach(cmark_strbuf *buf)
111
- {
112
- cmark_chunk c;
107
+ static CMARK_INLINE cmark_chunk cmark_chunk_buf_detach(cmark_strbuf *buf) {
108
+ cmark_chunk c;
113
109
 
114
- c.len = buf->size;
115
- c.data = cmark_strbuf_detach(buf);
116
- c.alloc = 1;
110
+ c.len = buf->size;
111
+ c.data = cmark_strbuf_detach(buf);
112
+ c.alloc = 1;
117
113
 
118
- return c;
114
+ return c;
119
115
  }
120
116
 
121
117
  #endif
@@ -6,26 +6,18 @@
6
6
  #include "cmark.h"
7
7
  #include "buffer.h"
8
8
 
9
- int cmark_version()
10
- {
11
- return CMARK_VERSION;
12
- }
9
+ int cmark_version() { return CMARK_VERSION; }
13
10
 
14
- const char *cmark_version_string()
15
- {
16
- return CMARK_VERSION_STRING;
17
- }
11
+ const char *cmark_version_string() { return CMARK_VERSION_STRING; }
18
12
 
19
- char *cmark_markdown_to_html(const char *text, size_t len, int options)
20
- {
21
- cmark_node *doc;
22
- char *result;
13
+ char *cmark_markdown_to_html(const char *text, size_t len, int options) {
14
+ cmark_node *doc;
15
+ char *result;
23
16
 
24
- doc = cmark_parse_document(text, len, options);
17
+ doc = cmark_parse_document(text, len, options);
25
18
 
26
- result = cmark_render_html(doc, options);
27
- cmark_node_free(doc);
19
+ result = cmark_render_html(doc, options);
20
+ cmark_node_free(doc);
28
21
 
29
- return result;
22
+ return result;
30
23
  }
31
-