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
@@ -101,6 +101,21 @@
101
101
 
102
102
  */
103
103
 
104
+ #ifdef __APPLE__
105
+ #include "TargetConditionals.h"
106
+ #if TARGET_IPHONE_SIMULATOR
107
+ // iOS Simulator
108
+ #undef USE_CURL
109
+ #elif TARGET_OS_IPHONE
110
+ // iOS device
111
+ #undef USE_CURL
112
+ #elif TARGET_OS_MAC
113
+ // Other kinds of Mac OS
114
+ #else
115
+ # error "Unknown Apple platform"
116
+ #endif
117
+ #endif
118
+
104
119
  #ifdef USE_CURL
105
120
  #include <curl/curl.h>
106
121
  #endif
@@ -176,7 +191,7 @@ char * opendocument_metadata(mmd_engine * e, scratch_pad * scratch) {
176
191
  for (m = scratch->meta_hash; m != NULL; m = m->hh.next) {
177
192
  if (strcmp(m->key, "author") == 0) {
178
193
  print_const("\t<dc:creator>");
179
- mmd_print_string_opendocument(out, m->value);
194
+ mmd_print_string_opendocument(out, m->value, false);
180
195
  print_const("</dc:creator>\n");
181
196
  } else if (strcmp(m->key, "baseheaderlevel") == 0) {
182
197
  } else if (strcmp(m->key, "bibliostyle") == 0) {
@@ -197,20 +212,20 @@ char * opendocument_metadata(mmd_engine * e, scratch_pad * scratch) {
197
212
  } else if (strcmp(m->key, "mmdfooter") == 0) {
198
213
  } else if (strcmp(m->key, "mmdheader") == 0) {
199
214
  } else if (strcmp(m->key, "odfheader") == 0) {
200
- mmd_print_string_opendocument(out, m->value);
215
+ mmd_print_string_opendocument(out, m->value, false);
201
216
  } else if (strcmp(m->key, "quoteslanguage") == 0) {
202
217
  } else if (strcmp(m->key, "title") == 0) {
203
218
  print_const("\t<dc:title>");
204
- mmd_print_string_opendocument(out, m->value);
219
+ mmd_print_string_opendocument(out, m->value, false);
205
220
  print_const("</dc:title>\n");
206
221
  } else if (strcmp(m->key, "transcludebase") == 0) {
207
222
  } else if (strcmp(m->key, "xhtmlheader") == 0) {
208
223
  } else if (strcmp(m->key, "xhtmlheaderlevel") == 0) {
209
224
  } else {
210
225
  print_const("\t<meta:user-defined meta:name=\"");
211
- mmd_print_string_opendocument(out, m->key);
226
+ mmd_print_string_opendocument(out, m->key, false);
212
227
  print_const("\">");
213
- mmd_print_string_opendocument(out, m->value);
228
+ mmd_print_string_opendocument(out, m->value, false);
214
229
  print_const("</meta:user-defined>\n");
215
230
  }
216
231
  }
@@ -635,7 +650,7 @@ static void add_assets(mz_zip_archive * pZip, mmd_engine * e, const char * direc
635
650
  if (res != CURLE_OK) {
636
651
  // Attempt to add asset from local file
637
652
  if (!add_asset_from_file(pZip, a, destination, directory)) {
638
- fprintf(stderr, "Unable to store '%s' in EPUB\n", a->url);
653
+ fprintf(stderr, "Unable to store '%s' in OpenDocument\n", a->url);
639
654
  }
640
655
  } else {
641
656
  // Store downloaded file in zip
@@ -665,7 +680,7 @@ static void add_assets(mz_zip_archive * pZip, mmd_engine * e, const char * direc
665
680
 
666
681
  // Attempt to add asset from local file
667
682
  if (!add_asset_from_file(pZip, a, destination, directory)) {
668
- fprintf(stderr, "Unable to store '%s' in EPUB\n", a->url);
683
+ fprintf(stderr, "Unable to store '%s' in OpenDocument\n", a->url);
669
684
  }
670
685
  }
671
686
  }
@@ -861,7 +876,13 @@ char * opendocument_content_file(const char * body, int format) {
861
876
  print_const("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
862
877
  print_const("<office:document-content ");
863
878
  opendocument_document_attr(out);
864
- print_const(">\n<office:body>\n");
879
+ print_const(">\n");
880
+
881
+ char * style = opendocument_style(format);
882
+ d_string_append(out, style);
883
+ free(style);
884
+
885
+ print_const("<office:body>\n");
865
886
 
866
887
  switch (format) {
867
888
  case FORMAT_ODT:
@@ -889,7 +910,7 @@ char * opendocument_content_file(const char * body, int format) {
889
910
 
890
911
 
891
912
  /// Create OpenDocument text file
892
- DString * opendocument_core_flat_create(const char * body, mmd_engine * e, int format) {
913
+ DString * opendocument_core_flat_create(DString * body, mmd_engine * e, int format) {
893
914
  DString * out = d_string_new("");
894
915
  char * text;
895
916
 
@@ -919,7 +940,7 @@ DString * opendocument_core_flat_create(const char * body, mmd_engine * e, int f
919
940
 
920
941
  // Add body
921
942
  print_const("\n<office:body>\n<office:text>\n");
922
- d_string_append(out, body);
943
+ d_string_append(out, body->str);
923
944
  print_const("\n</office:text>\n</office:body>\n</office:document>\n");
924
945
 
925
946
 
@@ -931,7 +952,7 @@ DString * opendocument_core_flat_create(const char * body, mmd_engine * e, int f
931
952
 
932
953
 
933
954
  /// Create OpenDocument zip file version
934
- DString * opendocument_core_file_create(const char * body, mmd_engine * e, const char * directory, int format) {
955
+ DString * opendocument_core_file_create(DString * body, mmd_engine * e, const char * directory, int format) {
935
956
  DString * result = d_string_new("");
936
957
 
937
958
  // Add common core elements
@@ -943,7 +964,7 @@ DString * opendocument_core_file_create(const char * body, mmd_engine * e, const
943
964
 
944
965
 
945
966
  // Create content file
946
- data = opendocument_content_file(body, format);
967
+ data = opendocument_content_file(body->str, format);
947
968
  len = strlen(data);
948
969
  status = mz_zip_writer_add_mem(zip, "content.xml", data, len, MZ_BEST_COMPRESSION);
949
970
  free(data);
@@ -971,13 +992,13 @@ DString * opendocument_core_file_create(const char * body, mmd_engine * e, const
971
992
 
972
993
 
973
994
  /// Create OpenDocument flat text file (single xml file)
974
- DString * opendocument_flat_text_create(const char * body, mmd_engine * e, const char * directory) {
995
+ DString * opendocument_flat_text_create(DString * body, mmd_engine * e, const char * directory) {
975
996
  return opendocument_core_flat_create(body, e, FORMAT_FODT);
976
997
  }
977
998
 
978
999
 
979
1000
  /// Create OpenDocument text file (zipped package)
980
- DString * opendocument_text_create(const char * body, mmd_engine * e, const char * directory) {
1001
+ DString * opendocument_text_create(DString * body, mmd_engine * e, const char * directory) {
981
1002
  return opendocument_core_file_create(body, e, directory, FORMAT_ODT);
982
1003
  }
983
1004
 
@@ -112,7 +112,7 @@
112
112
  char * opendocument_metadata(mmd_engine * e, scratch_pad * scratch);
113
113
 
114
114
 
115
- DString * opendocument_flat_text_create(const char * body, mmd_engine * e, const char * directory);
116
- DString * opendocument_text_create(const char * body, mmd_engine * e, const char * directory);
115
+ DString * opendocument_flat_text_create(DString * body, mmd_engine * e, const char * directory);
116
+ DString * opendocument_text_create(DString * body, mmd_engine * e, const char * directory);
117
117
 
118
118
  #endif