rmultimarkdown 6.4.0.4 → 6.7.0.0

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 (76) hide show
  1. checksums.yaml +5 -5
  2. data/Rakefile +7 -13
  3. data/ext/Makefile +67 -55
  4. data/ext/extconf.rb +7 -5
  5. data/ext/mmd/aho-corasick.c +8 -8
  6. data/ext/mmd/aho-corasick.h +3 -3
  7. data/ext/mmd/argtable3.c +6537 -0
  8. data/ext/mmd/argtable3.h +273 -0
  9. data/ext/mmd/beamer.c +12 -1
  10. data/ext/mmd/char.c +120 -27
  11. data/ext/mmd/char.h +23 -23
  12. data/ext/mmd/critic_markup.c +7 -6
  13. data/ext/mmd/d_string.c +88 -32
  14. data/ext/mmd/{include/d_string.h → d_string.h} +50 -38
  15. data/ext/mmd/epub.c +36 -12
  16. data/ext/mmd/epub.h +2 -2
  17. data/ext/mmd/file.c +50 -40
  18. data/ext/mmd/file.h +2 -2
  19. data/ext/mmd/html.c +164 -99
  20. data/ext/mmd/html.h +3 -2
  21. data/ext/mmd/i18n.h +15 -11
  22. data/ext/mmd/itmz-lexer.c +16978 -0
  23. data/ext/mmd/itmz-lexer.h +132 -0
  24. data/ext/mmd/itmz-parser.c +1189 -0
  25. data/ext/mmd/itmz-parser.h +11 -0
  26. data/ext/mmd/itmz-reader.c +388 -0
  27. data/ext/mmd/itmz-reader.h +111 -0
  28. data/ext/mmd/itmz.c +567 -0
  29. data/ext/mmd/itmz.h +117 -0
  30. data/ext/mmd/latex.c +93 -41
  31. data/ext/mmd/lexer.c +3506 -2774
  32. data/ext/mmd/{include/libMultiMarkdown.h → libMultiMarkdown.h} +49 -2
  33. data/ext/mmd/main.c +612 -0
  34. data/ext/mmd/memoir.c +4 -1
  35. data/ext/mmd/miniz.c +6905 -6680
  36. data/ext/mmd/miniz.h +456 -476
  37. data/ext/mmd/mmd.c +399 -94
  38. data/ext/mmd/mmd.h +25 -25
  39. data/ext/mmd/object_pool.h +3 -3
  40. data/ext/mmd/opendocument-content.c +137 -69
  41. data/ext/mmd/opendocument-content.h +2 -2
  42. data/ext/mmd/opendocument.c +35 -14
  43. data/ext/mmd/opendocument.h +2 -2
  44. data/ext/mmd/opml-lexer.c +259 -637
  45. data/ext/mmd/opml-lexer.h +1 -17
  46. data/ext/mmd/opml-parser.c +194 -188
  47. data/ext/mmd/opml-reader.c +72 -142
  48. data/ext/mmd/opml-reader.h +1 -1
  49. data/ext/mmd/opml.c +13 -13
  50. data/ext/mmd/opml.h +1 -1
  51. data/ext/mmd/parser.c +1623 -1244
  52. data/ext/mmd/rng.c +8 -3
  53. data/ext/mmd/scanners.c +66625 -103198
  54. data/ext/mmd/scanners.h +1 -0
  55. data/ext/mmd/stack.c +62 -20
  56. data/ext/mmd/stack.h +10 -21
  57. data/ext/mmd/textbundle.c +23 -7
  58. data/ext/mmd/textbundle.h +2 -2
  59. data/ext/mmd/token.c +42 -16
  60. data/ext/mmd/{include/token.h → token.h} +22 -8
  61. data/ext/mmd/token_pairs.c +0 -16
  62. data/ext/mmd/transclude.c +6 -2
  63. data/ext/mmd/uthash.h +745 -745
  64. data/ext/mmd/version.h +8 -8
  65. data/ext/mmd/writer.c +225 -63
  66. data/ext/mmd/writer.h +50 -36
  67. data/ext/mmd/xml.c +855 -0
  68. data/ext/mmd/xml.h +134 -0
  69. data/ext/mmd/zip.c +71 -4
  70. data/ext/mmd/zip.h +7 -1
  71. data/ext/ruby_multi_markdown.c +9 -18
  72. data/lib/multi_markdown/version.rb +1 -1
  73. data/lib/multi_markdown.bundle +0 -0
  74. data/rmultimarkdown.gemspec +0 -2
  75. metadata +22 -28
  76. data/ext/mmd/char_lookup.c +0 -212
data/ext/mmd/writer.h CHANGED
@@ -60,20 +60,27 @@
60
60
  #include "CuTest.h"
61
61
  #endif
62
62
 
63
- #include "d_string.h"
63
+ #include "libMultiMarkdown.h"
64
+ #include "uthash.h"
65
+
66
+ /*
67
+ #include "d_string.h"
64
68
  #include "mmd.h"
65
69
  #include "stack.h"
66
70
  #include "token.h"
67
71
  #include "uthash.h"
68
-
72
+ */
69
73
 
70
74
  #define kMaxExportRecursiveDepth 1000 //!< Maximum recursion depth when exporting token tree -- to prevent stack overflow with "pathologic" input
71
75
 
72
76
  #define kMaxTableColumns 48 //!< Maximum number of table columns for specifying alignment
73
77
 
78
+ typedef struct asset asset;
79
+ typedef struct stack stack;
80
+
74
81
  typedef struct {
75
- struct link * link_hash;
76
- struct meta * meta_hash;
82
+ struct link * link_hash;
83
+ struct meta * meta_hash;
77
84
 
78
85
  unsigned long extensions;
79
86
  short output_format;
@@ -83,26 +90,29 @@ typedef struct {
83
90
  short skip_token;
84
91
 
85
92
  short footnote_para_counter;
86
- stack * used_footnotes;
87
- stack * inline_footnotes_to_free;
93
+ stack * used_footnotes;
94
+ stack * inline_footnotes_to_free;
88
95
  struct fn_holder * footnote_hash;
89
96
  short footnote_being_printed;
90
97
 
91
98
  int random_seed_base;
92
99
 
93
- stack * used_citations;
94
- stack * inline_citations_to_free;
100
+ int random_seed_base_labels;
101
+ int label_counter;
102
+
103
+ stack * used_citations;
104
+ stack * inline_citations_to_free;
95
105
  struct fn_holder * citation_hash;
96
106
  short citation_being_printed;
97
- char * bibtex_file;
107
+ char * bibtex_file;
98
108
 
99
- stack * used_glossaries;
100
- stack * inline_glossaries_to_free;
109
+ stack * used_glossaries;
110
+ stack * inline_glossaries_to_free;
101
111
  struct fn_holder * glossary_hash;
102
112
  short glossary_being_printed;
103
113
 
104
- stack * used_abbreviations;
105
- stack * inline_abbreviations_to_free;
114
+ stack * used_abbreviations;
115
+ stack * inline_abbreviations_to_free;
106
116
  struct fn_holder * abbreviation_hash;
107
117
 
108
118
  short language;
@@ -110,9 +120,9 @@ typedef struct {
110
120
 
111
121
  short base_header_level;
112
122
 
113
- stack * header_stack;
123
+ stack * header_stack;
114
124
 
115
- stack * outline_stack;
125
+ stack * outline_stack;
116
126
  short opml_item_closed;
117
127
 
118
128
  short recurse_depth;
@@ -124,27 +134,29 @@ typedef struct {
124
134
 
125
135
  short odf_para_type;
126
136
 
127
- struct asset * asset_hash;
137
+ struct asset * asset_hash;
128
138
  short store_assets;
129
139
  short remember_assets;
140
+
141
+ stack * critic_stack;
130
142
  } scratch_pad;
131
143
 
132
144
 
133
145
  struct attr {
134
- char * key;
135
- char * value;
136
- struct attr * next;
146
+ char * key;
147
+ char * value;
148
+ struct attr * next;
137
149
  };
138
150
 
139
151
  typedef struct attr attr;
140
152
 
141
153
  struct link {
142
- token * label;
143
- char * label_text;
144
- char * clean_text;
145
- char * url;
146
- char * title;
147
- attr * attributes;
154
+ token * label;
155
+ char * label_text;
156
+ char * clean_text;
157
+ char * url;
158
+ char * title;
159
+ attr * attributes;
148
160
  short flags;
149
161
  UT_hash_handle hh;
150
162
  };
@@ -159,10 +171,10 @@ enum link_flags {
159
171
  typedef struct link link;
160
172
 
161
173
  struct footnote {
162
- token * label;
163
- char * label_text;
164
- char * clean_text;
165
- token * content;
174
+ token * label;
175
+ char * label_text;
176
+ char * clean_text;
177
+ token * content;
166
178
  size_t count;
167
179
  bool free_para;
168
180
 
@@ -172,15 +184,15 @@ struct footnote {
172
184
  typedef struct footnote footnote;
173
185
 
174
186
  struct fn_holder {
175
- footnote * note;
187
+ footnote * note;
176
188
  UT_hash_handle hh;
177
189
  };
178
190
 
179
191
  typedef struct fn_holder fn_holder;
180
192
 
181
193
  struct meta {
182
- char * key;
183
- char * value;
194
+ char * key;
195
+ char * value;
184
196
  size_t start;
185
197
  UT_hash_handle hh;
186
198
  };
@@ -188,9 +200,9 @@ struct meta {
188
200
  typedef struct meta meta;
189
201
 
190
202
  struct abbr {
191
- char * abbr;
203
+ char * abbr;
192
204
  size_t abbr_len;
193
- char * expansion;
205
+ char * expansion;
194
206
  size_t expansion_len;
195
207
  UT_hash_handle hh;
196
208
  };
@@ -219,7 +231,7 @@ void link_free(link * l);
219
231
  void footnote_free(footnote * f);
220
232
 
221
233
  char * label_from_token(const char * source, token * t);
222
- char * label_from_header(const char * source, token * t);
234
+ char * label_from_header(const char * source, token * t, scratch_pad * scratch);
223
235
 
224
236
  void parse_brackets(const char * source, scratch_pad * scratch, token * bracket, link ** link, short * skip_token, bool * free_link);
225
237
 
@@ -255,10 +267,12 @@ token * manual_label_from_header(token * h, const char * source);
255
267
 
256
268
  char * label_from_string(const char * str);
257
269
 
258
- char * clean_string(const char * str, bool lowercase);
270
+ char * clean_string(const char * str, bool lowercase, bool clean_url);
259
271
 
260
272
  short raw_level_for_header(token * header);
261
273
 
274
+ void header_clean_trailing_whitespace(token * header, const char * source);
275
+
262
276
  void store_asset(scratch_pad * scratch_pad, char * url);
263
277
  asset * extract_asset(scratch_pad * scratch, char * url);
264
278
  void asset_free(asset * a);