commonmarker 0.0.1

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 (291) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +8 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +119 -0
  5. data/Rakefile +39 -0
  6. data/bin/commonmarker +41 -0
  7. data/commonmarker.gemspec +30 -0
  8. data/ext/commonmarker/cmark/CMakeLists.txt +25 -0
  9. data/ext/commonmarker/cmark/COPYING +192 -0
  10. data/ext/commonmarker/cmark/FindAsan.cmake +74 -0
  11. data/ext/commonmarker/cmark/Makefile +170 -0
  12. data/ext/commonmarker/cmark/Makefile.nmake +36 -0
  13. data/ext/commonmarker/cmark/README.md +169 -0
  14. data/ext/commonmarker/cmark/api_test/CMakeLists.txt +25 -0
  15. data/ext/commonmarker/cmark/api_test/cplusplus.cpp +15 -0
  16. data/ext/commonmarker/cmark/api_test/cplusplus.h +17 -0
  17. data/ext/commonmarker/cmark/api_test/harness.c +102 -0
  18. data/ext/commonmarker/cmark/api_test/harness.h +42 -0
  19. data/ext/commonmarker/cmark/api_test/main.c +700 -0
  20. data/ext/commonmarker/cmark/appveyor.yml +15 -0
  21. data/ext/commonmarker/cmark/bench/statistics.py +595 -0
  22. data/ext/commonmarker/cmark/bench/stats.py +19 -0
  23. data/ext/commonmarker/cmark/benchmarks.md +33 -0
  24. data/ext/commonmarker/cmark/build/CMakeCache.txt +362 -0
  25. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CMakeCCompiler.cmake +63 -0
  26. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CMakeCXXCompiler.cmake +64 -0
  27. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CMakeDetermineCompilerABI_C.bin +0 -0
  28. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CMakeDetermineCompilerABI_CXX.bin +0 -0
  29. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CMakeSystem.cmake +15 -0
  30. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CompilerIdC/CMakeCCompilerId.c +499 -0
  31. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CompilerIdC/a.out +0 -0
  32. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CompilerIdCXX/CMakeCXXCompilerId.cpp +489 -0
  33. data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CompilerIdCXX/a.out +0 -0
  34. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  35. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeError.log +30 -0
  36. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeOutput.log +598 -0
  37. data/ext/commonmarker/cmark/build/CMakeFiles/Makefile.cmake +77 -0
  38. data/ext/commonmarker/cmark/build/CMakeFiles/Makefile2 +268 -0
  39. data/ext/commonmarker/cmark/build/CMakeFiles/TargetDirectories.txt +4 -0
  40. data/ext/commonmarker/cmark/build/CMakeFiles/cmake.check_cache +1 -0
  41. data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.bin +0 -0
  42. data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.c +34 -0
  43. data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.cxx +405 -0
  44. data/ext/commonmarker/cmark/build/CMakeFiles/progress.marks +1 -0
  45. data/ext/commonmarker/cmark/build/CTestTestfile.cmake +10 -0
  46. data/ext/commonmarker/cmark/build/Makefile +237 -0
  47. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  48. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/C.includecache +92 -0
  49. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/CXX.includecache +36 -0
  50. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/DependInfo.cmake +29 -0
  51. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/build.make +155 -0
  52. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/cmake_clean.cmake +12 -0
  53. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/cplusplus.cpp.o +0 -0
  54. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/depend.internal +25 -0
  55. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/depend.make +25 -0
  56. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/flags.make +13 -0
  57. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/harness.c.o +0 -0
  58. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/link.txt +1 -0
  59. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/main.c.o +0 -0
  60. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/progress.make +4 -0
  61. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/progress.marks +1 -0
  62. data/ext/commonmarker/cmark/build/api_test/Makefile +277 -0
  63. data/ext/commonmarker/cmark/build/api_test/api_test +0 -0
  64. data/ext/commonmarker/cmark/build/api_test/cmake_install.cmake +29 -0
  65. data/ext/commonmarker/cmark/build/cmake_install.cmake +48 -0
  66. data/ext/commonmarker/cmark/build/man/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  67. data/ext/commonmarker/cmark/build/man/CMakeFiles/progress.marks +1 -0
  68. data/ext/commonmarker/cmark/build/man/Makefile +181 -0
  69. data/ext/commonmarker/cmark/build/man/cmake_install.cmake +37 -0
  70. data/ext/commonmarker/cmark/build/src/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  71. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/C.includecache +422 -0
  72. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/DependInfo.cmake +39 -0
  73. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/blocks.c.o +0 -0
  74. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/buffer.c.o +0 -0
  75. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/build.make +544 -0
  76. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/cmake_clean.cmake +27 -0
  77. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/cmark.c.o +0 -0
  78. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/cmark_ctype.c.o +0 -0
  79. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/commonmark.c.o +0 -0
  80. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/depend.internal +177 -0
  81. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/depend.make +177 -0
  82. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/flags.make +8 -0
  83. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/houdini_href_e.c.o +0 -0
  84. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/houdini_html_e.c.o +0 -0
  85. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/houdini_html_u.c.o +0 -0
  86. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/html.c.o +0 -0
  87. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/inlines.c.o +0 -0
  88. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/iterator.c.o +0 -0
  89. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/link.txt +1 -0
  90. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/main.c.o +0 -0
  91. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/man.c.o +0 -0
  92. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/node.c.o +0 -0
  93. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/progress.make +19 -0
  94. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/references.c.o +0 -0
  95. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/scanners.c.o +0 -0
  96. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/utf8.c.o +0 -0
  97. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/xml.c.o +0 -0
  98. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/C.includecache +394 -0
  99. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/DependInfo.cmake +44 -0
  100. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/blocks.c.o +0 -0
  101. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/buffer.c.o +0 -0
  102. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/build.make +522 -0
  103. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/cmake_clean.cmake +27 -0
  104. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/cmark.c.o +0 -0
  105. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/cmark_ctype.c.o +0 -0
  106. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/commonmark.c.o +0 -0
  107. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/depend.internal +169 -0
  108. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/depend.make +169 -0
  109. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/flags.make +8 -0
  110. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/houdini_href_e.c.o +0 -0
  111. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/houdini_html_e.c.o +0 -0
  112. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/houdini_html_u.c.o +0 -0
  113. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/html.c.o +0 -0
  114. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/inlines.c.o +0 -0
  115. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/iterator.c.o +0 -0
  116. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/link.txt +1 -0
  117. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/man.c.o +0 -0
  118. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/node.c.o +0 -0
  119. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/progress.make +18 -0
  120. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/references.c.o +0 -0
  121. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/scanners.c.o +0 -0
  122. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/utf8.c.o +0 -0
  123. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/xml.c.o +0 -0
  124. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/C.includecache +394 -0
  125. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/DependInfo.cmake +38 -0
  126. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/blocks.c.o +0 -0
  127. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/buffer.c.o +0 -0
  128. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/build.make +519 -0
  129. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmake_clean.cmake +26 -0
  130. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmake_clean_target.cmake +3 -0
  131. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmark.c.o +0 -0
  132. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmark_ctype.c.o +0 -0
  133. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/commonmark.c.o +0 -0
  134. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/depend.internal +169 -0
  135. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/depend.make +169 -0
  136. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/flags.make +8 -0
  137. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/houdini_href_e.c.o +0 -0
  138. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/houdini_html_e.c.o +0 -0
  139. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/houdini_html_u.c.o +0 -0
  140. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/html.c.o +0 -0
  141. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/inlines.c.o +0 -0
  142. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/iterator.c.o +0 -0
  143. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/link.txt +2 -0
  144. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/man.c.o +0 -0
  145. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/node.c.o +0 -0
  146. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/progress.make +18 -0
  147. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/references.c.o +0 -0
  148. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/scanners.c.o +0 -0
  149. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/utf8.c.o +0 -0
  150. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/xml.c.o +0 -0
  151. data/ext/commonmarker/cmark/build/src/CMakeFiles/progress.marks +1 -0
  152. data/ext/commonmarker/cmark/build/src/Makefile +814 -0
  153. data/ext/commonmarker/cmark/build/src/cmake_install.cmake +69 -0
  154. data/ext/commonmarker/cmark/build/src/cmark +0 -0
  155. data/ext/commonmarker/cmark/build/src/cmark_export.h +41 -0
  156. data/ext/commonmarker/cmark/build/src/cmark_version.h +7 -0
  157. data/ext/commonmarker/cmark/build/src/config.h +23 -0
  158. data/ext/commonmarker/cmark/build/src/libcmark.0.19.0.dylib +0 -0
  159. data/ext/commonmarker/cmark/build/src/libcmark.a +0 -0
  160. data/ext/commonmarker/cmark/build/src/libcmark.dylib +0 -0
  161. data/ext/commonmarker/cmark/build/src/libcmark.pc +10 -0
  162. data/ext/commonmarker/cmark/build/testdir/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  163. data/ext/commonmarker/cmark/build/testdir/CMakeFiles/progress.marks +1 -0
  164. data/ext/commonmarker/cmark/build/testdir/CTestTestfile.cmake +12 -0
  165. data/ext/commonmarker/cmark/build/testdir/Makefile +181 -0
  166. data/ext/commonmarker/cmark/build/testdir/cmake_install.cmake +29 -0
  167. data/ext/commonmarker/cmark/changelog.txt +153 -0
  168. data/ext/commonmarker/cmark/data/CaseFolding-3.2.0.txt +912 -0
  169. data/ext/commonmarker/cmark/man/CMakeLists.txt +8 -0
  170. data/ext/commonmarker/cmark/man/make_man_page.py +131 -0
  171. data/ext/commonmarker/cmark/man/man1/cmark.1 +54 -0
  172. data/ext/commonmarker/cmark/man/man3/cmark.3 +583 -0
  173. data/ext/commonmarker/cmark/nmake.bat +1 -0
  174. data/ext/commonmarker/cmark/src/CMakeLists.txt +166 -0
  175. data/ext/commonmarker/cmark/src/bench.h +27 -0
  176. data/ext/commonmarker/cmark/src/blocks.c +887 -0
  177. data/ext/commonmarker/cmark/src/buffer.c +381 -0
  178. data/ext/commonmarker/cmark/src/buffer.h +113 -0
  179. data/ext/commonmarker/cmark/src/case_fold_switch.inc +2637 -0
  180. data/ext/commonmarker/cmark/src/chunk.h +110 -0
  181. data/ext/commonmarker/cmark/src/cmark.c +24 -0
  182. data/ext/commonmarker/cmark/src/cmark.h +565 -0
  183. data/ext/commonmarker/cmark/src/cmark_ctype.c +53 -0
  184. data/ext/commonmarker/cmark/src/cmark_ctype.h +24 -0
  185. data/ext/commonmarker/cmark/src/cmark_version.h.in +7 -0
  186. data/ext/commonmarker/cmark/src/commonmark.c +607 -0
  187. data/ext/commonmarker/cmark/src/config.h.in +23 -0
  188. data/ext/commonmarker/cmark/src/debug.h +36 -0
  189. data/ext/commonmarker/cmark/src/houdini.h +52 -0
  190. data/ext/commonmarker/cmark/src/houdini_href_e.c +107 -0
  191. data/ext/commonmarker/cmark/src/houdini_html_e.c +81 -0
  192. data/ext/commonmarker/cmark/src/houdini_html_u.c +116 -0
  193. data/ext/commonmarker/cmark/src/html.c +322 -0
  194. data/ext/commonmarker/cmark/src/html_unescape.gperf +2130 -0
  195. data/ext/commonmarker/cmark/src/html_unescape.h +13375 -0
  196. data/ext/commonmarker/cmark/src/inlines.c +1147 -0
  197. data/ext/commonmarker/cmark/src/inlines.h +19 -0
  198. data/ext/commonmarker/cmark/src/iterator.c +148 -0
  199. data/ext/commonmarker/cmark/src/iterator.h +25 -0
  200. data/ext/commonmarker/cmark/src/libcmark.pc.in +10 -0
  201. data/ext/commonmarker/cmark/src/main.c +191 -0
  202. data/ext/commonmarker/cmark/src/man.c +287 -0
  203. data/ext/commonmarker/cmark/src/node.c +873 -0
  204. data/ext/commonmarker/cmark/src/node.h +82 -0
  205. data/ext/commonmarker/cmark/src/parser.h +29 -0
  206. data/ext/commonmarker/cmark/src/references.c +154 -0
  207. data/ext/commonmarker/cmark/src/references.h +37 -0
  208. data/ext/commonmarker/cmark/src/scanners.c +15291 -0
  209. data/ext/commonmarker/cmark/src/scanners.h +41 -0
  210. data/ext/commonmarker/cmark/src/scanners.re +247 -0
  211. data/ext/commonmarker/cmark/src/utf8.c +452 -0
  212. data/ext/commonmarker/cmark/src/utf8.h +22 -0
  213. data/ext/commonmarker/cmark/src/xml.c +170 -0
  214. data/ext/commonmarker/cmark/test/CMakeLists.txt +53 -0
  215. data/ext/commonmarker/cmark/test/afl_dictionary/asterisk +1 -0
  216. data/ext/commonmarker/cmark/test/afl_dictionary/attr_generic +1 -0
  217. data/ext/commonmarker/cmark/test/afl_dictionary/attr_href +1 -0
  218. data/ext/commonmarker/cmark/test/afl_dictionary/attr_xml_lang +1 -0
  219. data/ext/commonmarker/cmark/test/afl_dictionary/attr_xmlns +1 -0
  220. data/ext/commonmarker/cmark/test/afl_dictionary/backslash +1 -0
  221. data/ext/commonmarker/cmark/test/afl_dictionary/backtick +1 -0
  222. data/ext/commonmarker/cmark/test/afl_dictionary/colon +1 -0
  223. data/ext/commonmarker/cmark/test/afl_dictionary/dashes +1 -0
  224. data/ext/commonmarker/cmark/test/afl_dictionary/double_quote +1 -0
  225. data/ext/commonmarker/cmark/test/afl_dictionary/entity_builtin +1 -0
  226. data/ext/commonmarker/cmark/test/afl_dictionary/entity_decimal +1 -0
  227. data/ext/commonmarker/cmark/test/afl_dictionary/entity_external +1 -0
  228. data/ext/commonmarker/cmark/test/afl_dictionary/entity_hex +1 -0
  229. data/ext/commonmarker/cmark/test/afl_dictionary/equals +1 -0
  230. data/ext/commonmarker/cmark/test/afl_dictionary/exclamation +1 -0
  231. data/ext/commonmarker/cmark/test/afl_dictionary/greater_than +1 -0
  232. data/ext/commonmarker/cmark/test/afl_dictionary/hash +1 -0
  233. data/ext/commonmarker/cmark/test/afl_dictionary/hyphen +0 -0
  234. data/ext/commonmarker/cmark/test/afl_dictionary/indent +1 -0
  235. data/ext/commonmarker/cmark/test/afl_dictionary/left_bracket +1 -0
  236. data/ext/commonmarker/cmark/test/afl_dictionary/left_paren +1 -0
  237. data/ext/commonmarker/cmark/test/afl_dictionary/less_than +1 -0
  238. data/ext/commonmarker/cmark/test/afl_dictionary/plus +1 -0
  239. data/ext/commonmarker/cmark/test/afl_dictionary/right_bracket +1 -0
  240. data/ext/commonmarker/cmark/test/afl_dictionary/right_paren +1 -0
  241. data/ext/commonmarker/cmark/test/afl_dictionary/single_quote +1 -0
  242. data/ext/commonmarker/cmark/test/afl_dictionary/string_any +1 -0
  243. data/ext/commonmarker/cmark/test/afl_dictionary/string_brackets +1 -0
  244. data/ext/commonmarker/cmark/test/afl_dictionary/string_cdata +1 -0
  245. data/ext/commonmarker/cmark/test/afl_dictionary/string_dashes +1 -0
  246. data/ext/commonmarker/cmark/test/afl_dictionary/string_empty_dblquotes +1 -0
  247. data/ext/commonmarker/cmark/test/afl_dictionary/string_empty_quotes +1 -0
  248. data/ext/commonmarker/cmark/test/afl_dictionary/string_idrefs +1 -0
  249. data/ext/commonmarker/cmark/test/afl_dictionary/string_parentheses +1 -0
  250. data/ext/commonmarker/cmark/test/afl_dictionary/string_pcdata +1 -0
  251. data/ext/commonmarker/cmark/test/afl_dictionary/tag_cdata +1 -0
  252. data/ext/commonmarker/cmark/test/afl_dictionary/tag_close +1 -0
  253. data/ext/commonmarker/cmark/test/afl_dictionary/tag_doctype +1 -0
  254. data/ext/commonmarker/cmark/test/afl_dictionary/tag_element +1 -0
  255. data/ext/commonmarker/cmark/test/afl_dictionary/tag_entity +1 -0
  256. data/ext/commonmarker/cmark/test/afl_dictionary/tag_notation +1 -0
  257. data/ext/commonmarker/cmark/test/afl_dictionary/tag_open +1 -0
  258. data/ext/commonmarker/cmark/test/afl_dictionary/tag_open_close +1 -0
  259. data/ext/commonmarker/cmark/test/afl_dictionary/tag_open_exclamation +1 -0
  260. data/ext/commonmarker/cmark/test/afl_dictionary/tag_open_q +1 -0
  261. data/ext/commonmarker/cmark/test/afl_dictionary/tag_sq2_close +1 -0
  262. data/ext/commonmarker/cmark/test/afl_dictionary/tag_xml_q +1 -0
  263. data/ext/commonmarker/cmark/test/afl_dictionary/underscore +1 -0
  264. data/ext/commonmarker/cmark/test/afl_test_cases/test.md +36 -0
  265. data/ext/commonmarker/cmark/test/cmark.py +40 -0
  266. data/ext/commonmarker/cmark/test/normalize.py +179 -0
  267. data/ext/commonmarker/cmark/test/pathological_tests.py +63 -0
  268. data/ext/commonmarker/cmark/test/roundtrip.sh +2 -0
  269. data/ext/commonmarker/cmark/test/smart_punct.txt +96 -0
  270. data/ext/commonmarker/cmark/test/spec.txt +7505 -0
  271. data/ext/commonmarker/cmark/test/spec_tests.py +139 -0
  272. data/ext/commonmarker/cmark/toolchain-mingw32.cmake +17 -0
  273. data/ext/commonmarker/cmark/tools/mkcasefold.pl +22 -0
  274. data/ext/commonmarker/cmark/wrappers/wrapper.lua +239 -0
  275. data/ext/commonmarker/cmark/wrappers/wrapper.py +37 -0
  276. data/ext/commonmarker/cmark/wrappers/wrapper.rb +15 -0
  277. data/ext/commonmarker/cmark/wrappers/wrapper.rkt +190 -0
  278. data/ext/commonmarker/commonmarker.c +165 -0
  279. data/ext/commonmarker/commonmarker.h +11 -0
  280. data/ext/commonmarker/extconf.rb +18 -0
  281. data/lib/commonmarker/config.rb +20 -0
  282. data/lib/commonmarker/version.rb +3 -0
  283. data/lib/commonmarker.rb +588 -0
  284. data/test/benchmark.rb +30 -0
  285. data/test/spec_tests.json +4074 -0
  286. data/test/test_basics.rb +44 -0
  287. data/test/test_helper.rb +5 -0
  288. data/test/test_maliciousness.rb +9 -0
  289. data/test/test_pathological_inputs.rb +52 -0
  290. data/test/test_spec.rb +20 -0
  291. metadata +399 -0
@@ -0,0 +1,381 @@
1
+ #include <stdarg.h>
2
+ #include <string.h>
3
+ #include <assert.h>
4
+ #include <string.h>
5
+ #include <stdio.h>
6
+ #include <stdlib.h>
7
+
8
+ #include "config.h"
9
+ #include "cmark_ctype.h"
10
+ #include "buffer.h"
11
+
12
+ /* Used as default value for cmark_strbuf->ptr so that people can always
13
+ * assume ptr is non-NULL and zero terminated even for new cmark_strbufs.
14
+ */
15
+ unsigned char cmark_strbuf__initbuf[1];
16
+ unsigned char cmark_strbuf__oom[1];
17
+
18
+ #define ENSURE_SIZE(b, d) \
19
+ if ((d) > buf->asize && cmark_strbuf_grow(b, (d)) < 0) \
20
+ return -1;
21
+
22
+ #ifndef MIN
23
+ #define MIN(x,y) ((x<y) ? x : y)
24
+ #endif
25
+
26
+ void cmark_strbuf_init(cmark_strbuf *buf, int initial_size)
27
+ {
28
+ buf->asize = 0;
29
+ buf->size = 0;
30
+ buf->ptr = cmark_strbuf__initbuf;
31
+
32
+ if (initial_size)
33
+ cmark_strbuf_grow(buf, initial_size);
34
+ }
35
+
36
+ int cmark_strbuf_try_grow(cmark_strbuf *buf, int target_size, bool mark_oom)
37
+ {
38
+ unsigned char *new_ptr;
39
+ int new_size;
40
+
41
+ if (buf->ptr == cmark_strbuf__oom)
42
+ return -1;
43
+
44
+ if (target_size <= buf->asize)
45
+ return 0;
46
+
47
+ if (buf->asize == 0) {
48
+ new_size = target_size;
49
+ new_ptr = NULL;
50
+ } else {
51
+ new_size = buf->asize;
52
+ new_ptr = buf->ptr;
53
+ }
54
+
55
+ /* grow the buffer size by 1.5, until it's big enough
56
+ * to fit our target size */
57
+ while (new_size < target_size)
58
+ new_size = (new_size << 1) - (new_size >> 1);
59
+
60
+ /* round allocation up to multiple of 8 */
61
+ new_size = (new_size + 7) & ~7;
62
+
63
+ new_ptr = (unsigned char *)realloc(new_ptr, new_size);
64
+
65
+ if (!new_ptr) {
66
+ if (mark_oom)
67
+ buf->ptr = cmark_strbuf__oom;
68
+ return -1;
69
+ }
70
+
71
+ buf->asize = new_size;
72
+ buf->ptr = new_ptr;
73
+
74
+ /* truncate the existing buffer size if necessary */
75
+ if (buf->size >= buf->asize)
76
+ buf->size = buf->asize - 1;
77
+ buf->ptr[buf->size] = '\0';
78
+
79
+ return 0;
80
+ }
81
+
82
+ int cmark_strbuf_grow(cmark_strbuf *buf, int target_size)
83
+ {
84
+ return cmark_strbuf_try_grow(buf, target_size, true);
85
+ }
86
+
87
+ bool cmark_strbuf_oom(const cmark_strbuf *buf)
88
+ {
89
+ return (buf->ptr == cmark_strbuf__oom);
90
+ }
91
+
92
+ size_t cmark_strbuf_len(const cmark_strbuf *buf)
93
+ {
94
+ return buf->size;
95
+ }
96
+
97
+ void cmark_strbuf_free(cmark_strbuf *buf)
98
+ {
99
+ if (!buf) return;
100
+
101
+ if (buf->ptr != cmark_strbuf__initbuf && buf->ptr != cmark_strbuf__oom)
102
+ free(buf->ptr);
103
+
104
+ cmark_strbuf_init(buf, 0);
105
+ }
106
+
107
+ void cmark_strbuf_clear(cmark_strbuf *buf)
108
+ {
109
+ buf->size = 0;
110
+
111
+ if (buf->asize > 0)
112
+ buf->ptr[0] = '\0';
113
+ }
114
+
115
+ int cmark_strbuf_set(cmark_strbuf *buf, const unsigned char *data, int len)
116
+ {
117
+ if (len <= 0 || data == NULL) {
118
+ cmark_strbuf_clear(buf);
119
+ } else {
120
+ if (data != buf->ptr) {
121
+ ENSURE_SIZE(buf, len + 1);
122
+ memmove(buf->ptr, data, len);
123
+ }
124
+ buf->size = len;
125
+ buf->ptr[buf->size] = '\0';
126
+ }
127
+ return 0;
128
+ }
129
+
130
+ int cmark_strbuf_sets(cmark_strbuf *buf, const char *string)
131
+ {
132
+ return cmark_strbuf_set(buf,
133
+ (const unsigned char *)string,
134
+ string ? strlen(string) : 0);
135
+ }
136
+
137
+ int cmark_strbuf_putc(cmark_strbuf *buf, int c)
138
+ {
139
+ ENSURE_SIZE(buf, buf->size + 2);
140
+ buf->ptr[buf->size++] = c;
141
+ buf->ptr[buf->size] = '\0';
142
+ return 0;
143
+ }
144
+
145
+ int cmark_strbuf_put(cmark_strbuf *buf, const unsigned char *data, int len)
146
+ {
147
+ if (len <= 0)
148
+ return 0;
149
+
150
+ ENSURE_SIZE(buf, buf->size + len + 1);
151
+ memmove(buf->ptr + buf->size, data, len);
152
+ buf->size += len;
153
+ buf->ptr[buf->size] = '\0';
154
+ return 0;
155
+ }
156
+
157
+ int cmark_strbuf_puts(cmark_strbuf *buf, const char *string)
158
+ {
159
+ return cmark_strbuf_put(buf, (const unsigned char *)string, strlen(string));
160
+ }
161
+
162
+ int cmark_strbuf_vprintf(cmark_strbuf *buf, const char *format, va_list ap)
163
+ {
164
+ const int expected_size = buf->size + (strlen(format) * 2);
165
+ int len;
166
+
167
+ ENSURE_SIZE(buf, expected_size);
168
+
169
+ while (1) {
170
+ va_list args;
171
+ va_copy(args, ap);
172
+
173
+ len = vsnprintf(
174
+ (char *)buf->ptr + buf->size,
175
+ buf->asize - buf->size,
176
+ format, args
177
+ );
178
+
179
+ va_end(args);
180
+
181
+ if (len < 0) {
182
+ free(buf->ptr);
183
+ buf->ptr = cmark_strbuf__oom;
184
+ return -1;
185
+ }
186
+
187
+ if (len + 1 <= buf->asize - buf->size) {
188
+ buf->size += len;
189
+ break;
190
+ }
191
+
192
+ ENSURE_SIZE(buf, buf->size + len + 1);
193
+ }
194
+
195
+ return 0;
196
+ }
197
+
198
+ int cmark_strbuf_printf(cmark_strbuf *buf, const char *format, ...)
199
+ {
200
+ int r;
201
+ va_list ap;
202
+
203
+ va_start(ap, format);
204
+ r = cmark_strbuf_vprintf(buf, format, ap);
205
+ va_end(ap);
206
+
207
+ return r;
208
+ }
209
+
210
+ void cmark_strbuf_copy_cstr(char *data, int datasize, const cmark_strbuf *buf)
211
+ {
212
+ int copylen;
213
+
214
+ assert(data && datasize && buf);
215
+
216
+ data[0] = '\0';
217
+
218
+ if (buf->size == 0 || buf->asize <= 0)
219
+ return;
220
+
221
+ copylen = buf->size;
222
+ if (copylen > datasize - 1)
223
+ copylen = datasize - 1;
224
+ memmove(data, buf->ptr, copylen);
225
+ data[copylen] = '\0';
226
+ }
227
+
228
+ void cmark_strbuf_swap(cmark_strbuf *buf_a, cmark_strbuf *buf_b)
229
+ {
230
+ cmark_strbuf t = *buf_a;
231
+ *buf_a = *buf_b;
232
+ *buf_b = t;
233
+ }
234
+
235
+ unsigned char *cmark_strbuf_detach(cmark_strbuf *buf)
236
+ {
237
+ unsigned char *data = buf->ptr;
238
+
239
+ if (buf->asize == 0 || buf->ptr == cmark_strbuf__oom) {
240
+ /* return an empty string */
241
+ return (unsigned char *)calloc(1, 1);
242
+ }
243
+
244
+ cmark_strbuf_init(buf, 0);
245
+ return data;
246
+ }
247
+
248
+ void cmark_strbuf_attach(cmark_strbuf *buf, unsigned char *ptr, int asize)
249
+ {
250
+ cmark_strbuf_free(buf);
251
+
252
+ if (ptr) {
253
+ buf->ptr = ptr;
254
+ buf->size = strlen((char *)ptr);
255
+ if (asize)
256
+ buf->asize = (asize < buf->size) ? buf->size + 1 : asize;
257
+ else /* pass 0 to fall back on strlen + 1 */
258
+ buf->asize = buf->size + 1;
259
+ } else {
260
+ cmark_strbuf_grow(buf, asize);
261
+ }
262
+ }
263
+
264
+ int cmark_strbuf_cmp(const cmark_strbuf *a, const cmark_strbuf *b)
265
+ {
266
+ int result = memcmp(a->ptr, b->ptr, MIN(a->size, b->size));
267
+ return (result != 0) ? result :
268
+ (a->size < b->size) ? -1 : (a->size > b->size) ? 1 : 0;
269
+ }
270
+
271
+ int cmark_strbuf_strchr(const cmark_strbuf *buf, int c, int pos)
272
+ {
273
+ const unsigned char *p = (unsigned char *)memchr(buf->ptr + pos, c, buf->size - pos);
274
+ if (!p)
275
+ return -1;
276
+
277
+ return (int)(p - (const unsigned char *)buf->ptr);
278
+ }
279
+
280
+ int cmark_strbuf_strrchr(const cmark_strbuf *buf, int c, int pos)
281
+ {
282
+ int i;
283
+
284
+ for (i = pos; i >= 0; i--) {
285
+ if (buf->ptr[i] == (unsigned char) c)
286
+ return i;
287
+ }
288
+
289
+ return -1;
290
+ }
291
+
292
+ void cmark_strbuf_truncate(cmark_strbuf *buf, int len)
293
+ {
294
+ if (len < buf->size) {
295
+ buf->size = len;
296
+ buf->ptr[buf->size] = '\0';
297
+ }
298
+ }
299
+
300
+ void cmark_strbuf_drop(cmark_strbuf *buf, int n)
301
+ {
302
+ if (n > 0) {
303
+ buf->size = buf->size - n;
304
+ if (buf->size)
305
+ memmove(buf->ptr, buf->ptr + n, buf->size);
306
+
307
+ buf->ptr[buf->size] = '\0';
308
+ }
309
+ }
310
+
311
+ void cmark_strbuf_rtrim(cmark_strbuf *buf)
312
+ {
313
+ if (!buf->size)
314
+ return;
315
+
316
+ while (buf->size > 0) {
317
+ if (!cmark_isspace(buf->ptr[buf->size - 1]))
318
+ break;
319
+
320
+ buf->size--;
321
+ }
322
+
323
+ buf->ptr[buf->size] = '\0';
324
+ }
325
+
326
+ void cmark_strbuf_trim(cmark_strbuf *buf)
327
+ {
328
+ int i = 0;
329
+
330
+ if (!buf->size)
331
+ return;
332
+
333
+ while (i < buf->size && cmark_isspace(buf->ptr[i]))
334
+ i++;
335
+
336
+ cmark_strbuf_drop(buf, i);
337
+
338
+ cmark_strbuf_rtrim(buf);
339
+ }
340
+
341
+ // Destructively modify string, collapsing consecutive
342
+ // space and newline characters into a single space.
343
+ void cmark_strbuf_normalize_whitespace(cmark_strbuf *s)
344
+ {
345
+ bool last_char_was_space = false;
346
+ int r, w;
347
+
348
+ for (r = 0, w = 0; r < s->size; ++r) {
349
+ switch (s->ptr[r]) {
350
+ case ' ':
351
+ case '\n':
352
+ if (last_char_was_space)
353
+ break;
354
+
355
+ s->ptr[w++] = ' ';
356
+ last_char_was_space = true;
357
+ break;
358
+
359
+ default:
360
+ s->ptr[w++] = s->ptr[r];
361
+ last_char_was_space = false;
362
+ }
363
+ }
364
+
365
+ cmark_strbuf_truncate(s, w);
366
+ }
367
+
368
+ // Destructively unescape a string: remove backslashes before punctuation chars.
369
+ extern void cmark_strbuf_unescape(cmark_strbuf *buf)
370
+ {
371
+ int r, w;
372
+
373
+ for (r = 0, w = 0; r < buf->size; ++r) {
374
+ if (buf->ptr[r] == '\\' && cmark_ispunct(buf->ptr[r + 1]))
375
+ r++;
376
+
377
+ buf->ptr[w++] = buf->ptr[r];
378
+ }
379
+
380
+ cmark_strbuf_truncate(buf, w);
381
+ }
@@ -0,0 +1,113 @@
1
+ #ifndef CMARK_BUFFER_H
2
+ #define CMARK_BUFFER_H
3
+
4
+ #include <stddef.h>
5
+ #include <stdarg.h>
6
+ #include "config.h"
7
+
8
+ #ifdef __cplusplus
9
+ extern "C" {
10
+ #endif
11
+
12
+ typedef struct {
13
+ unsigned char *ptr;
14
+ int asize, size;
15
+ } cmark_strbuf;
16
+
17
+ extern unsigned char cmark_strbuf__initbuf[];
18
+
19
+ extern unsigned char cmark_strbuf__oom[];
20
+
21
+ #define GH_BUF_INIT { cmark_strbuf__initbuf, 0, 0 }
22
+
23
+ /**
24
+ * Initialize a cmark_strbuf structure.
25
+ *
26
+ * For the cases where GH_BUF_INIT cannot be used to do static
27
+ * initialization.
28
+ */
29
+ void cmark_strbuf_init(cmark_strbuf *buf, int initial_size);
30
+
31
+ /**
32
+ * Attempt to grow the buffer to hold at least `target_size` bytes.
33
+ *
34
+ * If the allocation fails, this will return an error. If mark_oom is true,
35
+ * this will mark the buffer as invalid for future operations; if false,
36
+ * existing buffer content will be preserved, but calling code must handle
37
+ * that buffer was not expanded.
38
+ */
39
+ int cmark_strbuf_try_grow(cmark_strbuf *buf, int target_size, bool mark_oom);
40
+
41
+ /**
42
+ * Grow the buffer to hold at least `target_size` bytes.
43
+ *
44
+ * If the allocation fails, this will return an error and the buffer will be
45
+ * marked as invalid for future operations, invaliding contents.
46
+ *
47
+ * @return 0 on success or -1 on failure
48
+ */
49
+ int cmark_strbuf_grow(cmark_strbuf *buf, int target_size);
50
+
51
+ void cmark_strbuf_free(cmark_strbuf *buf);
52
+ void cmark_strbuf_swap(cmark_strbuf *buf_a, cmark_strbuf *buf_b);
53
+
54
+ /**
55
+ * Test if there have been any reallocation failures with this cmark_strbuf.
56
+ *
57
+ * Any function that writes to a cmark_strbuf can fail due to memory allocation
58
+ * issues. If one fails, the cmark_strbuf will be marked with an OOM error and
59
+ * further calls to modify the buffer will fail. Check cmark_strbuf_oom() at the
60
+ * end of your sequence and it will be true if you ran out of memory at any
61
+ * point with that buffer.
62
+ *
63
+ * @return false if no error, true if allocation error
64
+ */
65
+ bool cmark_strbuf_oom(const cmark_strbuf *buf);
66
+
67
+ size_t cmark_strbuf_len(const cmark_strbuf *buf);
68
+
69
+ int cmark_strbuf_cmp(const cmark_strbuf *a, const cmark_strbuf *b);
70
+
71
+ void cmark_strbuf_attach(cmark_strbuf *buf, unsigned char *ptr, int asize);
72
+ unsigned char *cmark_strbuf_detach(cmark_strbuf *buf);
73
+ void cmark_strbuf_copy_cstr(char *data, int datasize, const cmark_strbuf *buf);
74
+
75
+ static inline const char *cmark_strbuf_cstr(const cmark_strbuf *buf)
76
+ {
77
+ return (char *)buf->ptr;
78
+ }
79
+
80
+ #define cmark_strbuf_at(buf, n) ((buf)->ptr[n])
81
+
82
+ /*
83
+ * Functions below that return int value error codes will return 0 on
84
+ * success or -1 on failure (which generally means an allocation failed).
85
+ * Using a cmark_strbuf where the allocation has failed with result in -1 from
86
+ * all further calls using that buffer. As a result, you can ignore the
87
+ * return code of these functions and call them in a series then just call
88
+ * cmark_strbuf_oom at the end.
89
+ */
90
+ int cmark_strbuf_set(cmark_strbuf *buf, const unsigned char *data, int len);
91
+ int cmark_strbuf_sets(cmark_strbuf *buf, const char *string);
92
+ int cmark_strbuf_putc(cmark_strbuf *buf, int c);
93
+ int cmark_strbuf_put(cmark_strbuf *buf, const unsigned char *data, int len);
94
+ int cmark_strbuf_puts(cmark_strbuf *buf, const char *string);
95
+ int cmark_strbuf_printf(cmark_strbuf *buf, const char *format, ...)
96
+ CMARK_ATTRIBUTE((format (printf, 2, 3)));
97
+ int cmark_strbuf_vprintf(cmark_strbuf *buf, const char *format, va_list ap);
98
+ void cmark_strbuf_clear(cmark_strbuf *buf);
99
+
100
+ int cmark_strbuf_strchr(const cmark_strbuf *buf, int c, int pos);
101
+ int cmark_strbuf_strrchr(const cmark_strbuf *buf, int c, int pos);
102
+ void cmark_strbuf_drop(cmark_strbuf *buf, int n);
103
+ void cmark_strbuf_truncate(cmark_strbuf *buf, int len);
104
+ void cmark_strbuf_rtrim(cmark_strbuf *buf);
105
+ void cmark_strbuf_trim(cmark_strbuf *buf);
106
+ void cmark_strbuf_normalize_whitespace(cmark_strbuf *s);
107
+ void cmark_strbuf_unescape(cmark_strbuf *s);
108
+
109
+ #ifdef __cplusplus
110
+ }
111
+ #endif
112
+
113
+ #endif