commonmarker 0.17.6 → 0.17.7

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 (405) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +0 -7
  3. data/ext/commonmarker/{cmark/src/arena.c → arena.c} +0 -0
  4. data/ext/commonmarker/{cmark/extensions/autolink.c → autolink.c} +0 -0
  5. data/ext/commonmarker/{cmark/extensions/autolink.h → autolink.h} +0 -0
  6. data/ext/commonmarker/{cmark/src/blocks.c → blocks.c} +0 -0
  7. data/ext/commonmarker/{cmark/src/buffer.c → buffer.c} +0 -0
  8. data/ext/commonmarker/{cmark/src/buffer.h → buffer.h} +0 -0
  9. data/ext/commonmarker/{cmark/src/case_fold_switch.inc → case_fold_switch.inc} +0 -0
  10. data/ext/commonmarker/{cmark/src/chunk.h → chunk.h} +0 -0
  11. data/ext/commonmarker/{cmark → cmark-upstream}/CMakeLists.txt +0 -0
  12. data/ext/commonmarker/{cmark → cmark-upstream}/COPYING +0 -0
  13. data/ext/commonmarker/{cmark → cmark-upstream}/FindAsan.cmake +0 -0
  14. data/ext/commonmarker/{cmark → cmark-upstream}/Makefile +0 -0
  15. data/ext/commonmarker/{cmark → cmark-upstream}/Makefile.nmake +0 -0
  16. data/ext/commonmarker/{cmark → cmark-upstream}/README.md +0 -0
  17. data/ext/commonmarker/{cmark → cmark-upstream}/api_test/CMakeLists.txt +0 -0
  18. data/ext/commonmarker/{cmark → cmark-upstream}/api_test/cplusplus.cpp +0 -0
  19. data/ext/commonmarker/{cmark → cmark-upstream}/api_test/cplusplus.h +0 -0
  20. data/ext/commonmarker/{cmark → cmark-upstream}/api_test/harness.c +0 -0
  21. data/ext/commonmarker/{cmark → cmark-upstream}/api_test/harness.h +0 -0
  22. data/ext/commonmarker/{cmark → cmark-upstream}/api_test/main.c +0 -0
  23. data/ext/commonmarker/{cmark → cmark-upstream}/appveyor.yml +0 -0
  24. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-bq-flat.md +0 -0
  25. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-bq-nested.md +0 -0
  26. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-code.md +0 -0
  27. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-fences.md +0 -0
  28. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-heading.md +0 -0
  29. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-hr.md +0 -0
  30. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-html.md +0 -0
  31. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-lheading.md +0 -0
  32. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-list-flat.md +0 -0
  33. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-list-nested.md +0 -0
  34. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-ref-flat.md +0 -0
  35. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-ref-nested.md +0 -0
  36. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-autolink.md +0 -0
  37. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-backticks.md +0 -0
  38. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-em-flat.md +0 -0
  39. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-em-nested.md +0 -0
  40. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-em-worst.md +0 -0
  41. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-entity.md +0 -0
  42. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-escape.md +0 -0
  43. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-html.md +0 -0
  44. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-links-flat.md +0 -0
  45. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-links-nested.md +0 -0
  46. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-newlines.md +0 -0
  47. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/lorem1.md +0 -0
  48. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/rawtabs.md +0 -0
  49. data/ext/commonmarker/{cmark → cmark-upstream}/bench/statistics.py +0 -0
  50. data/ext/commonmarker/{cmark → cmark-upstream}/bench/stats.py +0 -0
  51. data/ext/commonmarker/{cmark → cmark-upstream}/benchmarks.md +0 -0
  52. data/ext/commonmarker/cmark-upstream/build/CMakeCache.txt +478 -0
  53. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CMakeCCompiler.cmake +71 -0
  54. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CMakeCXXCompiler.cmake +73 -0
  55. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CMakeDetermineCompilerABI_C.bin +0 -0
  56. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CMakeDetermineCompilerABI_CXX.bin +0 -0
  57. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CMakeSystem.cmake +15 -0
  58. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CompilerIdC/CMakeCCompilerId.c +567 -0
  59. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CompilerIdC/a.out +0 -0
  60. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CompilerIdCXX/CMakeCXXCompilerId.cpp +539 -0
  61. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CompilerIdCXX/a.out +0 -0
  62. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  63. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/CMakeError.log +18 -0
  64. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/CMakeOutput.log +709 -0
  65. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/Makefile.cmake +157 -0
  66. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/Makefile2 +391 -0
  67. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/TargetDirectories.txt +48 -0
  68. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/cmake.check_cache +1 -0
  69. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/feature_tests.bin +0 -0
  70. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/feature_tests.c +34 -0
  71. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/feature_tests.cxx +405 -0
  72. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/progress.marks +1 -0
  73. data/ext/commonmarker/cmark-upstream/build/CTestTestfile.cmake +11 -0
  74. data/ext/commonmarker/cmark-upstream/build/Makefile +280 -0
  75. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  76. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/C.includecache +134 -0
  77. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/CXX.includecache +38 -0
  78. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/DependInfo.cmake +38 -0
  79. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/build.make +169 -0
  80. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/cmake_clean.cmake +12 -0
  81. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/cplusplus.cpp.o +0 -0
  82. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/depend.internal +28 -0
  83. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/depend.make +28 -0
  84. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/flags.make +17 -0
  85. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/harness.c.o +0 -0
  86. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/link.txt +1 -0
  87. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/main.c.o +0 -0
  88. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/progress.make +5 -0
  89. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/progress.marks +1 -0
  90. data/ext/commonmarker/cmark-upstream/build/api_test/Makefile +302 -0
  91. data/ext/commonmarker/cmark-upstream/build/api_test/api_test +0 -0
  92. data/ext/commonmarker/cmark-upstream/build/api_test/cmake_install.cmake +29 -0
  93. data/ext/commonmarker/cmark-upstream/build/cmake_install.cmake +49 -0
  94. data/ext/commonmarker/cmark-upstream/build/compile_commands.json +352 -0
  95. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  96. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/Export/lib/cmake-gfmextensions/cmark-gfmextensions-release.cmake +30 -0
  97. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/Export/lib/cmake-gfmextensions/cmark-gfmextensions.cmake +108 -0
  98. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/C.includecache +246 -0
  99. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/DependInfo.cmake +36 -0
  100. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/autolink.c.o +0 -0
  101. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/build.make +253 -0
  102. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/cmake_clean.cmake +16 -0
  103. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/core-extensions.c.o +0 -0
  104. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/depend.internal +96 -0
  105. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/depend.make +96 -0
  106. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/ext_scanners.c.o +0 -0
  107. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/flags.make +10 -0
  108. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/link.txt +1 -0
  109. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/progress.make +8 -0
  110. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/strikethrough.c.o +0 -0
  111. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/table.c.o +0 -0
  112. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/tagfilter.c.o +0 -0
  113. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/C.includecache +246 -0
  114. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/DependInfo.cmake +29 -0
  115. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/autolink.c.o +0 -0
  116. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/build.make +249 -0
  117. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/cmake_clean.cmake +15 -0
  118. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/cmake_clean_target.cmake +3 -0
  119. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/core-extensions.c.o +0 -0
  120. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/depend.internal +96 -0
  121. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/depend.make +96 -0
  122. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/ext_scanners.c.o +0 -0
  123. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/flags.make +10 -0
  124. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/link.txt +2 -0
  125. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/progress.make +8 -0
  126. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/strikethrough.c.o +0 -0
  127. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/table.c.o +0 -0
  128. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/tagfilter.c.o +0 -0
  129. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/progress.marks +1 -0
  130. data/ext/commonmarker/cmark-upstream/build/extensions/Makefile +426 -0
  131. data/ext/commonmarker/cmark-upstream/build/extensions/cmake_install.cmake +84 -0
  132. data/ext/commonmarker/cmark-upstream/build/extensions/cmarkextensions_export.h +42 -0
  133. data/ext/commonmarker/cmark-upstream/build/extensions/libcmark-gfmextensions.0.28.3.gfm.11.dylib +0 -0
  134. data/ext/commonmarker/cmark-upstream/build/extensions/libcmark-gfmextensions.a +0 -0
  135. data/ext/commonmarker/cmark-upstream/build/extensions/libcmark-gfmextensions.dylib +1 -0
  136. data/ext/commonmarker/cmark-upstream/build/man/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  137. data/ext/commonmarker/cmark-upstream/build/man/CMakeFiles/progress.marks +1 -0
  138. data/ext/commonmarker/cmark-upstream/build/man/Makefile +196 -0
  139. data/ext/commonmarker/cmark-upstream/build/man/cmake_install.cmake +37 -0
  140. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  141. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/Export/lib/cmake/cmark-gfm-release.cmake +38 -0
  142. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/Export/lib/cmake/cmark-gfm.cmake +95 -0
  143. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/C.includecache +156 -0
  144. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/DependInfo.cmake +30 -0
  145. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/build.make +115 -0
  146. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/cmake_clean.cmake +10 -0
  147. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/depend.internal +20 -0
  148. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/depend.make +20 -0
  149. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/flags.make +10 -0
  150. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/link.txt +1 -0
  151. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/main.c.o +0 -0
  152. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/progress.make +3 -0
  153. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/C.includecache +612 -0
  154. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/DependInfo.cmake +60 -0
  155. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/arena.c.o +0 -0
  156. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/blocks.c.o +0 -0
  157. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/buffer.c.o +0 -0
  158. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/build.make +819 -0
  159. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/cmake_clean.cmake +37 -0
  160. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/cmark.c.o +0 -0
  161. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/cmark_ctype.c.o +0 -0
  162. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/commonmark.c.o +0 -0
  163. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/depend.internal +319 -0
  164. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/depend.make +319 -0
  165. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/flags.make +10 -0
  166. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/footnotes.c.o +0 -0
  167. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/houdini_href_e.c.o +0 -0
  168. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/houdini_html_e.c.o +0 -0
  169. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/houdini_html_u.c.o +0 -0
  170. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/html.c.o +0 -0
  171. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/inlines.c.o +0 -0
  172. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/iterator.c.o +0 -0
  173. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/latex.c.o +0 -0
  174. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/link.txt +1 -0
  175. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/linked_list.c.o +0 -0
  176. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/man.c.o +0 -0
  177. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/map.c.o +0 -0
  178. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/node.c.o +0 -0
  179. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/plaintext.c.o +0 -0
  180. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/plugin.c.o +0 -0
  181. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/progress.make +29 -0
  182. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/references.c.o +0 -0
  183. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/registry.c.o +0 -0
  184. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/render.c.o +0 -0
  185. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/scanners.c.o +0 -0
  186. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/syntax_extension.c.o +0 -0
  187. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/utf8.c.o +0 -0
  188. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/xml.c.o +0 -0
  189. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/C.includecache +612 -0
  190. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/DependInfo.cmake +54 -0
  191. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/arena.c.o +0 -0
  192. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/blocks.c.o +0 -0
  193. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/buffer.c.o +0 -0
  194. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/build.make +816 -0
  195. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/cmake_clean.cmake +36 -0
  196. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/cmake_clean_target.cmake +3 -0
  197. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/cmark.c.o +0 -0
  198. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/cmark_ctype.c.o +0 -0
  199. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/commonmark.c.o +0 -0
  200. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/depend.internal +319 -0
  201. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/depend.make +319 -0
  202. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/flags.make +10 -0
  203. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/footnotes.c.o +0 -0
  204. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_href_e.c.o +0 -0
  205. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_html_e.c.o +0 -0
  206. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_html_u.c.o +0 -0
  207. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/html.c.o +0 -0
  208. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/inlines.c.o +0 -0
  209. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/iterator.c.o +0 -0
  210. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/latex.c.o +0 -0
  211. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/link.txt +2 -0
  212. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/linked_list.c.o +0 -0
  213. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/man.c.o +0 -0
  214. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/map.c.o +0 -0
  215. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/node.c.o +0 -0
  216. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/plaintext.c.o +0 -0
  217. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/plugin.c.o +0 -0
  218. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/progress.make +29 -0
  219. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/references.c.o +0 -0
  220. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/registry.c.o +0 -0
  221. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/render.c.o +0 -0
  222. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/scanners.c.o +0 -0
  223. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/syntax_extension.c.o +0 -0
  224. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/utf8.c.o +0 -0
  225. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/xml.c.o +0 -0
  226. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/progress.marks +1 -0
  227. data/ext/commonmarker/cmark-upstream/build/src/Makefile +1165 -0
  228. data/ext/commonmarker/cmark-upstream/build/src/cmake_install.cmake +97 -0
  229. data/ext/commonmarker/cmark-upstream/build/src/cmark-gfm +0 -0
  230. data/ext/commonmarker/cmark-upstream/build/src/cmark_export.h +42 -0
  231. data/ext/commonmarker/cmark-upstream/build/src/cmark_version.h +8 -0
  232. data/ext/commonmarker/cmark-upstream/build/src/config.h +76 -0
  233. data/ext/commonmarker/cmark-upstream/build/src/libcmark-gfm.0.28.3.gfm.11.dylib +0 -0
  234. data/ext/commonmarker/cmark-upstream/build/src/libcmark-gfm.a +0 -0
  235. data/ext/commonmarker/cmark-upstream/build/src/libcmark-gfm.dylib +1 -0
  236. data/ext/commonmarker/cmark-upstream/build/src/libcmark-gfm.pc +10 -0
  237. data/ext/commonmarker/cmark-upstream/build/testdir/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  238. data/ext/commonmarker/cmark-upstream/build/testdir/CMakeFiles/progress.marks +1 -0
  239. data/ext/commonmarker/cmark-upstream/build/testdir/CTestTestfile.cmake +17 -0
  240. data/ext/commonmarker/cmark-upstream/build/testdir/Makefile +196 -0
  241. data/ext/commonmarker/cmark-upstream/build/testdir/cmake_install.cmake +29 -0
  242. data/ext/commonmarker/{cmark → cmark-upstream}/changelog.txt +0 -0
  243. data/ext/commonmarker/{cmark → cmark-upstream}/data/CaseFolding.txt +0 -0
  244. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/CMakeLists.txt +0 -0
  245. data/ext/commonmarker/cmark-upstream/extensions/autolink.c +421 -0
  246. data/ext/commonmarker/cmark-upstream/extensions/autolink.h +8 -0
  247. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/core-extensions.c +0 -0
  248. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/core-extensions.h +0 -0
  249. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/ext_scanners.c +0 -0
  250. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/ext_scanners.h +0 -0
  251. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/ext_scanners.re +0 -0
  252. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/strikethrough.c +0 -0
  253. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/strikethrough.h +0 -0
  254. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/table.c +0 -0
  255. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/table.h +0 -0
  256. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/tagfilter.c +0 -0
  257. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/tagfilter.h +0 -0
  258. data/ext/commonmarker/{cmark → cmark-upstream}/man/CMakeLists.txt +0 -0
  259. data/ext/commonmarker/{cmark → cmark-upstream}/man/make_man_page.py +0 -0
  260. data/ext/commonmarker/{cmark → cmark-upstream}/man/man1/cmark-gfm.1 +0 -0
  261. data/ext/commonmarker/{cmark → cmark-upstream}/man/man3/cmark-gfm.3 +0 -0
  262. data/ext/commonmarker/{cmark → cmark-upstream}/nmake.bat +0 -0
  263. data/ext/commonmarker/{cmark → cmark-upstream}/src/CMakeLists.txt +0 -0
  264. data/ext/commonmarker/cmark-upstream/src/arena.c +103 -0
  265. data/ext/commonmarker/cmark-upstream/src/blocks.c +1519 -0
  266. data/ext/commonmarker/cmark-upstream/src/buffer.c +279 -0
  267. data/ext/commonmarker/cmark-upstream/src/buffer.h +116 -0
  268. data/ext/commonmarker/cmark-upstream/src/case_fold_switch.inc +4327 -0
  269. data/ext/commonmarker/cmark-upstream/src/chunk.h +136 -0
  270. data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark.c +0 -0
  271. data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark.h +0 -0
  272. data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark_ctype.c +0 -0
  273. data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark_ctype.h +0 -0
  274. data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark_extension_api.h +0 -0
  275. data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark_version.h.in +0 -0
  276. data/ext/commonmarker/{cmark → cmark-upstream}/src/commonmark.c +0 -0
  277. data/ext/commonmarker/{cmark → cmark-upstream}/src/config.h.in +0 -0
  278. data/ext/commonmarker/{cmark → cmark-upstream}/src/entities.inc +0 -0
  279. data/ext/commonmarker/{cmark → cmark-upstream}/src/footnotes.c +0 -0
  280. data/ext/commonmarker/{cmark → cmark-upstream}/src/footnotes.h +0 -0
  281. data/ext/commonmarker/{cmark → cmark-upstream}/src/houdini.h +0 -0
  282. data/ext/commonmarker/{cmark → cmark-upstream}/src/houdini_href_e.c +0 -0
  283. data/ext/commonmarker/{cmark → cmark-upstream}/src/houdini_html_e.c +0 -0
  284. data/ext/commonmarker/{cmark → cmark-upstream}/src/houdini_html_u.c +0 -0
  285. data/ext/commonmarker/{cmark → cmark-upstream}/src/html.c +0 -0
  286. data/ext/commonmarker/{cmark → cmark-upstream}/src/html.h +0 -0
  287. data/ext/commonmarker/{cmark → cmark-upstream}/src/inlines.c +8 -4
  288. data/ext/commonmarker/{cmark → cmark-upstream}/src/inlines.h +0 -0
  289. data/ext/commonmarker/{cmark → cmark-upstream}/src/iterator.c +0 -0
  290. data/ext/commonmarker/{cmark → cmark-upstream}/src/iterator.h +0 -0
  291. data/ext/commonmarker/{cmark → cmark-upstream}/src/latex.c +0 -0
  292. data/ext/commonmarker/{cmark → cmark-upstream}/src/libcmark-gfm.pc.in +0 -0
  293. data/ext/commonmarker/{cmark → cmark-upstream}/src/linked_list.c +0 -0
  294. data/ext/commonmarker/{cmark → cmark-upstream}/src/main.c +0 -0
  295. data/ext/commonmarker/{cmark → cmark-upstream}/src/man.c +0 -0
  296. data/ext/commonmarker/{cmark → cmark-upstream}/src/map.c +0 -0
  297. data/ext/commonmarker/{cmark → cmark-upstream}/src/map.h +0 -0
  298. data/ext/commonmarker/{cmark → cmark-upstream}/src/node.c +0 -0
  299. data/ext/commonmarker/{cmark → cmark-upstream}/src/node.h +0 -0
  300. data/ext/commonmarker/{cmark → cmark-upstream}/src/parser.h +0 -0
  301. data/ext/commonmarker/{cmark → cmark-upstream}/src/plaintext.c +0 -0
  302. data/ext/commonmarker/{cmark → cmark-upstream}/src/plugin.c +0 -0
  303. data/ext/commonmarker/{cmark → cmark-upstream}/src/plugin.h +0 -0
  304. data/ext/commonmarker/{cmark → cmark-upstream}/src/references.c +0 -0
  305. data/ext/commonmarker/{cmark → cmark-upstream}/src/references.h +0 -0
  306. data/ext/commonmarker/{cmark → cmark-upstream}/src/registry.c +0 -0
  307. data/ext/commonmarker/{cmark → cmark-upstream}/src/registry.h +0 -0
  308. data/ext/commonmarker/{cmark → cmark-upstream}/src/render.c +0 -0
  309. data/ext/commonmarker/{cmark → cmark-upstream}/src/render.h +0 -0
  310. data/ext/commonmarker/{cmark → cmark-upstream}/src/scanners.c +0 -0
  311. data/ext/commonmarker/{cmark → cmark-upstream}/src/scanners.h +0 -0
  312. data/ext/commonmarker/{cmark → cmark-upstream}/src/scanners.re +0 -0
  313. data/ext/commonmarker/{cmark → cmark-upstream}/src/syntax_extension.c +0 -0
  314. data/ext/commonmarker/{cmark → cmark-upstream}/src/syntax_extension.h +0 -0
  315. data/ext/commonmarker/{cmark → cmark-upstream}/src/utf8.c +0 -0
  316. data/ext/commonmarker/{cmark → cmark-upstream}/src/utf8.h +0 -0
  317. data/ext/commonmarker/{cmark → cmark-upstream}/src/xml.c +0 -0
  318. data/ext/commonmarker/{cmark → cmark-upstream}/suppressions +0 -0
  319. data/ext/commonmarker/{cmark → cmark-upstream}/test/CMakeLists.txt +0 -0
  320. data/ext/commonmarker/{cmark → cmark-upstream}/test/afl_test_cases/test.md +0 -0
  321. data/ext/commonmarker/{cmark → cmark-upstream}/test/cmark-fuzz.c +0 -0
  322. data/ext/commonmarker/{cmark → cmark-upstream}/test/cmark.py +0 -0
  323. data/ext/commonmarker/{cmark → cmark-upstream}/test/entity_tests.py +0 -0
  324. data/ext/commonmarker/{cmark → cmark-upstream}/test/extensions.txt +2 -2
  325. data/ext/commonmarker/{cmark → cmark-upstream}/test/fuzzing_dictionary +0 -0
  326. data/ext/commonmarker/{cmark → cmark-upstream}/test/normalize.py +0 -0
  327. data/ext/commonmarker/{cmark → cmark-upstream}/test/pathological_tests.py +0 -0
  328. data/ext/commonmarker/{cmark → cmark-upstream}/test/regression.txt +0 -0
  329. data/ext/commonmarker/{cmark → cmark-upstream}/test/roundtrip_tests.py +0 -0
  330. data/ext/commonmarker/{cmark → cmark-upstream}/test/run-cmark-fuzz +0 -0
  331. data/ext/commonmarker/{cmark → cmark-upstream}/test/smart_punct.txt +0 -0
  332. data/ext/commonmarker/{cmark → cmark-upstream}/test/spec.txt +0 -0
  333. data/ext/commonmarker/{cmark → cmark-upstream}/test/spec_tests.py +0 -0
  334. data/ext/commonmarker/{cmark → cmark-upstream}/toolchain-mingw32.cmake +0 -0
  335. data/ext/commonmarker/{cmark → cmark-upstream}/tools/Dockerfile +0 -0
  336. data/ext/commonmarker/{cmark → cmark-upstream}/tools/appveyor-build.bat +0 -0
  337. data/ext/commonmarker/{cmark → cmark-upstream}/tools/make_entities_inc.py +0 -0
  338. data/ext/commonmarker/{cmark → cmark-upstream}/tools/mkcasefold.pl +0 -0
  339. data/ext/commonmarker/{cmark → cmark-upstream}/why-cmark-and-not-x.md +0 -0
  340. data/ext/commonmarker/{cmark → cmark-upstream}/wrappers/wrapper.js +0 -0
  341. data/ext/commonmarker/{cmark → cmark-upstream}/wrappers/wrapper.py +0 -0
  342. data/ext/commonmarker/{cmark → cmark-upstream}/wrappers/wrapper.rb +0 -0
  343. data/ext/commonmarker/{cmark → cmark-upstream}/wrappers/wrapper.rkt +0 -0
  344. data/ext/commonmarker/cmark.c +55 -0
  345. data/ext/commonmarker/cmark.h +789 -0
  346. data/ext/commonmarker/cmark_ctype.c +44 -0
  347. data/ext/commonmarker/cmark_ctype.h +33 -0
  348. data/ext/commonmarker/cmark_export.h +42 -0
  349. data/ext/commonmarker/cmark_extension_api.h +719 -0
  350. data/ext/commonmarker/cmark_version.h +8 -0
  351. data/ext/commonmarker/cmarkextensions_export.h +42 -0
  352. data/ext/commonmarker/commonmark.c +508 -0
  353. data/ext/commonmarker/config.h +76 -0
  354. data/ext/commonmarker/core-extensions.c +25 -0
  355. data/ext/commonmarker/core-extensions.h +25 -0
  356. data/ext/commonmarker/entities.inc +2138 -0
  357. data/ext/commonmarker/ext_scanners.c +941 -0
  358. data/ext/commonmarker/ext_scanners.h +22 -0
  359. data/ext/commonmarker/extconf.rb +1 -48
  360. data/ext/commonmarker/footnotes.c +40 -0
  361. data/ext/commonmarker/footnotes.h +25 -0
  362. data/ext/commonmarker/houdini.h +57 -0
  363. data/ext/commonmarker/houdini_href_e.c +100 -0
  364. data/ext/commonmarker/houdini_html_e.c +66 -0
  365. data/ext/commonmarker/houdini_html_u.c +149 -0
  366. data/ext/commonmarker/html.c +457 -0
  367. data/ext/commonmarker/html.h +27 -0
  368. data/ext/commonmarker/inlines.c +1594 -0
  369. data/ext/commonmarker/inlines.h +29 -0
  370. data/ext/commonmarker/iterator.c +159 -0
  371. data/ext/commonmarker/iterator.h +27 -0
  372. data/ext/commonmarker/latex.c +466 -0
  373. data/ext/commonmarker/linked_list.c +37 -0
  374. data/ext/commonmarker/man.c +278 -0
  375. data/ext/commonmarker/map.c +122 -0
  376. data/ext/commonmarker/map.h +42 -0
  377. data/ext/commonmarker/node.c +965 -0
  378. data/ext/commonmarker/node.h +116 -0
  379. data/ext/commonmarker/parser.h +57 -0
  380. data/ext/commonmarker/plaintext.c +213 -0
  381. data/ext/commonmarker/plugin.c +36 -0
  382. data/ext/commonmarker/plugin.h +34 -0
  383. data/ext/commonmarker/references.c +42 -0
  384. data/ext/commonmarker/references.h +26 -0
  385. data/ext/commonmarker/registry.c +63 -0
  386. data/ext/commonmarker/registry.h +24 -0
  387. data/ext/commonmarker/render.c +202 -0
  388. data/ext/commonmarker/render.h +63 -0
  389. data/ext/commonmarker/scanners.c +18195 -0
  390. data/ext/commonmarker/scanners.h +64 -0
  391. data/ext/commonmarker/scanners.re +341 -0
  392. data/ext/commonmarker/strikethrough.c +157 -0
  393. data/ext/commonmarker/strikethrough.h +9 -0
  394. data/ext/commonmarker/syntax_extension.c +139 -0
  395. data/ext/commonmarker/syntax_extension.h +32 -0
  396. data/ext/commonmarker/table.c +683 -0
  397. data/ext/commonmarker/table.h +8 -0
  398. data/ext/commonmarker/tagfilter.c +60 -0
  399. data/ext/commonmarker/tagfilter.h +8 -0
  400. data/ext/commonmarker/utf8.c +317 -0
  401. data/ext/commonmarker/utf8.h +35 -0
  402. data/ext/commonmarker/xml.c +174 -0
  403. data/lib/commonmarker/version.rb +1 -1
  404. data/test/test_helper.rb +1 -1
  405. metadata +401 -145
@@ -0,0 +1,29 @@
1
+ # Install script for directory: /Users/kivikakk/Code/gjtorikian/commonmarker/ext/commonmarker/cmark-upstream/test
2
+
3
+ # Set the install prefix
4
+ if(NOT DEFINED CMAKE_INSTALL_PREFIX)
5
+ set(CMAKE_INSTALL_PREFIX "/usr/local")
6
+ endif()
7
+ string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
8
+
9
+ # Set the install configuration name.
10
+ if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
11
+ if(BUILD_TYPE)
12
+ string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
13
+ CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
14
+ else()
15
+ set(CMAKE_INSTALL_CONFIG_NAME "Release")
16
+ endif()
17
+ message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
18
+ endif()
19
+
20
+ # Set the component getting installed.
21
+ if(NOT CMAKE_INSTALL_COMPONENT)
22
+ if(COMPONENT)
23
+ message(STATUS "Install component: \"${COMPONENT}\"")
24
+ set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
25
+ else()
26
+ set(CMAKE_INSTALL_COMPONENT)
27
+ endif()
28
+ endif()
29
+
@@ -0,0 +1,421 @@
1
+ #include "autolink.h"
2
+ #include <parser.h>
3
+ #include <string.h>
4
+ #include <utf8.h>
5
+
6
+ #if defined(_WIN32)
7
+ #define strncasecmp _strnicmp
8
+ #else
9
+ #include <strings.h>
10
+ #endif
11
+
12
+ static int is_valid_hostchar(const uint8_t *link, size_t link_len) {
13
+ int32_t ch;
14
+ int r = cmark_utf8proc_iterate(link, (bufsize_t)link_len, &ch);
15
+ if (r < 0)
16
+ return 0;
17
+ return !cmark_utf8proc_is_space(ch) && !cmark_utf8proc_is_punctuation(ch);
18
+ }
19
+
20
+ static int sd_autolink_issafe(const uint8_t *link, size_t link_len) {
21
+ static const size_t valid_uris_count = 3;
22
+ static const char *valid_uris[] = {"http://", "https://", "ftp://"};
23
+
24
+ size_t i;
25
+
26
+ for (i = 0; i < valid_uris_count; ++i) {
27
+ size_t len = strlen(valid_uris[i]);
28
+
29
+ if (link_len > len && strncasecmp((char *)link, valid_uris[i], len) == 0 &&
30
+ is_valid_hostchar(link + len, link_len - len))
31
+ return 1;
32
+ }
33
+
34
+ return 0;
35
+ }
36
+
37
+ static size_t autolink_delim(uint8_t *data, size_t link_end) {
38
+ uint8_t cclose, copen;
39
+ size_t i;
40
+
41
+ for (i = 0; i < link_end; ++i)
42
+ if (data[i] == '<') {
43
+ link_end = i;
44
+ break;
45
+ }
46
+
47
+ while (link_end > 0) {
48
+ cclose = data[link_end - 1];
49
+
50
+ switch (cclose) {
51
+ case ')':
52
+ copen = '(';
53
+ break;
54
+ default:
55
+ copen = 0;
56
+ }
57
+
58
+ if (strchr("?!.,:*_~'\"", data[link_end - 1]) != NULL)
59
+ link_end--;
60
+
61
+ else if (data[link_end - 1] == ';') {
62
+ size_t new_end = link_end - 2;
63
+
64
+ while (new_end > 0 && cmark_isalpha(data[new_end]))
65
+ new_end--;
66
+
67
+ if (new_end < link_end - 2 && data[new_end] == '&')
68
+ link_end = new_end;
69
+ else
70
+ link_end--;
71
+ } else if (copen != 0) {
72
+ size_t closing = 0;
73
+ size_t opening = 0;
74
+ i = 0;
75
+
76
+ /* Allow any number of matching brackets (as recognised in copen/cclose)
77
+ * at the end of the URL. If there is a greater number of closing
78
+ * brackets than opening ones, we remove one character from the end of
79
+ * the link.
80
+ *
81
+ * Examples (input text => output linked portion):
82
+ *
83
+ * http://www.pokemon.com/Pikachu_(Electric)
84
+ * => http://www.pokemon.com/Pikachu_(Electric)
85
+ *
86
+ * http://www.pokemon.com/Pikachu_((Electric)
87
+ * => http://www.pokemon.com/Pikachu_((Electric)
88
+ *
89
+ * http://www.pokemon.com/Pikachu_(Electric))
90
+ * => http://www.pokemon.com/Pikachu_(Electric)
91
+ *
92
+ * http://www.pokemon.com/Pikachu_((Electric))
93
+ * => http://www.pokemon.com/Pikachu_((Electric))
94
+ */
95
+
96
+ while (i < link_end) {
97
+ if (data[i] == copen)
98
+ opening++;
99
+ else if (data[i] == cclose)
100
+ closing++;
101
+
102
+ i++;
103
+ }
104
+
105
+ if (closing <= opening)
106
+ break;
107
+
108
+ link_end--;
109
+ } else
110
+ break;
111
+ }
112
+
113
+ return link_end;
114
+ }
115
+
116
+ static size_t check_domain(uint8_t *data, size_t size, int allow_short) {
117
+ size_t i, np = 0, uscore1 = 0, uscore2 = 0;
118
+
119
+ for (i = 1; i < size - 1; i++) {
120
+ if (data[i] == '_')
121
+ uscore2++;
122
+ else if (data[i] == '.') {
123
+ uscore1 = uscore2;
124
+ uscore2 = 0;
125
+ np++;
126
+ } else if (!is_valid_hostchar(data + i, size - i) && data[i] != '-')
127
+ break;
128
+ }
129
+
130
+ if (uscore1 > 0 || uscore2 > 0)
131
+ return 0;
132
+
133
+ if (allow_short) {
134
+ /* We don't need a valid domain in the strict sense (with
135
+ * least one dot; so just make sure it's composed of valid
136
+ * domain characters and return the length of the the valid
137
+ * sequence. */
138
+ return i;
139
+ } else {
140
+ /* a valid domain needs to have at least a dot.
141
+ * that's as far as we get */
142
+ return np ? i : 0;
143
+ }
144
+ }
145
+
146
+ static cmark_node *www_match(cmark_parser *parser, cmark_node *parent,
147
+ cmark_inline_parser *inline_parser) {
148
+ cmark_chunk *chunk = cmark_inline_parser_get_chunk(inline_parser);
149
+ size_t max_rewind = cmark_inline_parser_get_offset(inline_parser);
150
+ uint8_t *data = chunk->data + max_rewind;
151
+ size_t size = chunk->len - max_rewind;
152
+ int start = cmark_inline_parser_get_column(inline_parser);
153
+
154
+ size_t link_end;
155
+
156
+ if (max_rewind > 0 && strchr("*_~(", data[-1]) == NULL &&
157
+ !cmark_isspace(data[-1]))
158
+ return 0;
159
+
160
+ if (size < 4 || memcmp(data, "www.", strlen("www.")) != 0)
161
+ return 0;
162
+
163
+ link_end = check_domain(data, size, 0);
164
+
165
+ if (link_end == 0)
166
+ return NULL;
167
+
168
+ while (link_end < size && !cmark_isspace(data[link_end]))
169
+ link_end++;
170
+
171
+ link_end = autolink_delim(data, link_end);
172
+
173
+ if (link_end == 0)
174
+ return NULL;
175
+
176
+ cmark_inline_parser_set_offset(inline_parser, (int)(max_rewind + link_end));
177
+
178
+ cmark_node *node = cmark_node_new_with_mem(CMARK_NODE_LINK, parser->mem);
179
+
180
+ cmark_strbuf buf;
181
+ cmark_strbuf_init(parser->mem, &buf, 10);
182
+ cmark_strbuf_puts(&buf, "http://");
183
+ cmark_strbuf_put(&buf, data, (bufsize_t)link_end);
184
+ node->as.link.url = cmark_chunk_buf_detach(&buf);
185
+
186
+ cmark_node *text = cmark_node_new_with_mem(CMARK_NODE_TEXT, parser->mem);
187
+ text->as.literal =
188
+ cmark_chunk_dup(chunk, (bufsize_t)max_rewind, (bufsize_t)link_end);
189
+ cmark_node_append_child(node, text);
190
+
191
+ node->start_line = text->start_line =
192
+ node->end_line = text->end_line =
193
+ cmark_inline_parser_get_line(inline_parser);
194
+
195
+ node->start_column = text->start_column = start - 1;
196
+ node->end_column = text->end_column = cmark_inline_parser_get_column(inline_parser) - 1;
197
+
198
+ return node;
199
+ }
200
+
201
+ static cmark_node *url_match(cmark_parser *parser, cmark_node *parent,
202
+ cmark_inline_parser *inline_parser) {
203
+ size_t link_end, domain_len;
204
+ int rewind = 0;
205
+
206
+ cmark_chunk *chunk = cmark_inline_parser_get_chunk(inline_parser);
207
+ int max_rewind = cmark_inline_parser_get_offset(inline_parser);
208
+ uint8_t *data = chunk->data + max_rewind;
209
+ size_t size = chunk->len - max_rewind;
210
+
211
+ if (size < 4 || data[1] != '/' || data[2] != '/')
212
+ return 0;
213
+
214
+ while (rewind < max_rewind && cmark_isalpha(data[-rewind - 1]))
215
+ rewind++;
216
+
217
+ if (!sd_autolink_issafe(data - rewind, size + rewind))
218
+ return 0;
219
+
220
+ link_end = strlen("://");
221
+
222
+ domain_len = check_domain(data + link_end, size - link_end, 1);
223
+
224
+ if (domain_len == 0)
225
+ return 0;
226
+
227
+ link_end += domain_len;
228
+ while (link_end < size && !cmark_isspace(data[link_end]))
229
+ link_end++;
230
+
231
+ link_end = autolink_delim(data, link_end);
232
+
233
+ if (link_end == 0)
234
+ return NULL;
235
+
236
+ cmark_inline_parser_set_offset(inline_parser, (int)(max_rewind + link_end));
237
+ cmark_node_unput(parent, rewind);
238
+
239
+ cmark_node *node = cmark_node_new_with_mem(CMARK_NODE_LINK, parser->mem);
240
+
241
+ cmark_chunk url = cmark_chunk_dup(chunk, max_rewind - rewind,
242
+ (bufsize_t)(link_end + rewind));
243
+ node->as.link.url = url;
244
+
245
+ cmark_node *text = cmark_node_new_with_mem(CMARK_NODE_TEXT, parser->mem);
246
+ text->as.literal = url;
247
+ cmark_node_append_child(node, text);
248
+
249
+ return node;
250
+ }
251
+
252
+ static cmark_node *match(cmark_syntax_extension *ext, cmark_parser *parser,
253
+ cmark_node *parent, unsigned char c,
254
+ cmark_inline_parser *inline_parser) {
255
+ if (cmark_inline_parser_in_bracket(inline_parser, false) ||
256
+ cmark_inline_parser_in_bracket(inline_parser, true))
257
+ return NULL;
258
+
259
+ if (c == ':')
260
+ return url_match(parser, parent, inline_parser);
261
+
262
+ if (c == 'w')
263
+ return www_match(parser, parent, inline_parser);
264
+
265
+ return NULL;
266
+
267
+ // note that we could end up re-consuming something already a
268
+ // part of an inline, because we don't track when the last
269
+ // inline was finished in inlines.c.
270
+ }
271
+
272
+ static void postprocess_text(cmark_parser *parser, cmark_node *text, int offset) {
273
+ size_t link_end;
274
+ uint8_t *data = text->as.literal.data,
275
+ *at;
276
+ size_t size = text->as.literal.len;
277
+ int rewind, max_rewind,
278
+ nb = 0, np = 0, ns = 0;
279
+
280
+ if (offset < 0 || (size_t)offset >= size)
281
+ return;
282
+
283
+ data += offset;
284
+ size -= offset;
285
+
286
+ at = (uint8_t *)memchr(data, '@', size);
287
+ if (!at)
288
+ return;
289
+
290
+ max_rewind = (int)(at - data);
291
+ data += max_rewind;
292
+ size -= max_rewind;
293
+
294
+ for (rewind = 0; rewind < max_rewind; ++rewind) {
295
+ uint8_t c = data[-rewind - 1];
296
+
297
+ if (cmark_isalnum(c))
298
+ continue;
299
+
300
+ if (strchr(".+-_", c) != NULL)
301
+ continue;
302
+
303
+ if (c == '/')
304
+ ns++;
305
+
306
+ break;
307
+ }
308
+
309
+ if (rewind == 0 || ns > 0) {
310
+ postprocess_text(parser, text, max_rewind + 1 + offset);
311
+ return;
312
+ }
313
+
314
+ for (link_end = 0; link_end < size; ++link_end) {
315
+ uint8_t c = data[link_end];
316
+
317
+ if (cmark_isalnum(c))
318
+ continue;
319
+
320
+ if (c == '@')
321
+ nb++;
322
+ else if (c == '.' && link_end < size - 1 && cmark_isalnum(data[link_end + 1]))
323
+ np++;
324
+ else if (c != '-' && c != '_')
325
+ break;
326
+ }
327
+
328
+ if (link_end < 2 || nb != 1 || np == 0 ||
329
+ (!cmark_isalpha(data[link_end - 1]) && data[link_end - 1] != '.')) {
330
+ postprocess_text(parser, text, max_rewind + 1 + offset);
331
+ return;
332
+ }
333
+
334
+ link_end = autolink_delim(data, link_end);
335
+
336
+ if (link_end == 0) {
337
+ postprocess_text(parser, text, max_rewind + 1 + offset);
338
+ return;
339
+ }
340
+
341
+ cmark_chunk_to_cstr(parser->mem, &text->as.literal);
342
+
343
+ cmark_node *link_node = cmark_node_new_with_mem(CMARK_NODE_LINK, parser->mem);
344
+ cmark_strbuf buf;
345
+ cmark_strbuf_init(parser->mem, &buf, 10);
346
+ cmark_strbuf_puts(&buf, "mailto:");
347
+ cmark_strbuf_put(&buf, data - rewind, (bufsize_t)(link_end + rewind));
348
+ link_node->as.link.url = cmark_chunk_buf_detach(&buf);
349
+
350
+ cmark_node *link_text = cmark_node_new_with_mem(CMARK_NODE_TEXT, parser->mem);
351
+ cmark_chunk email = cmark_chunk_dup(
352
+ &text->as.literal,
353
+ offset + max_rewind - rewind,
354
+ (bufsize_t)(link_end + rewind));
355
+ cmark_chunk_to_cstr(parser->mem, &email);
356
+ link_text->as.literal = email;
357
+ cmark_node_append_child(link_node, link_text);
358
+
359
+ cmark_node_insert_after(text, link_node);
360
+
361
+ cmark_node *post = cmark_node_new_with_mem(CMARK_NODE_TEXT, parser->mem);
362
+ post->as.literal = cmark_chunk_dup(&text->as.literal,
363
+ (bufsize_t)(offset + max_rewind + link_end),
364
+ (bufsize_t)(size - link_end));
365
+ cmark_chunk_to_cstr(parser->mem, &post->as.literal);
366
+
367
+ cmark_node_insert_after(link_node, post);
368
+
369
+ text->as.literal.len = offset + max_rewind - rewind;
370
+ text->as.literal.data[text->as.literal.len] = 0;
371
+
372
+ postprocess_text(parser, post, 0);
373
+ }
374
+
375
+ static cmark_node *postprocess(cmark_syntax_extension *ext, cmark_parser *parser, cmark_node *root) {
376
+ cmark_iter *iter;
377
+ cmark_event_type ev;
378
+ cmark_node *node;
379
+ bool in_link = false;
380
+
381
+ cmark_consolidate_text_nodes(root);
382
+ iter = cmark_iter_new(root);
383
+
384
+ while ((ev = cmark_iter_next(iter)) != CMARK_EVENT_DONE) {
385
+ node = cmark_iter_get_node(iter);
386
+ if (in_link) {
387
+ if (ev == CMARK_EVENT_EXIT && node->type == CMARK_NODE_LINK) {
388
+ in_link = false;
389
+ }
390
+ continue;
391
+ }
392
+
393
+ if (ev == CMARK_EVENT_ENTER && node->type == CMARK_NODE_LINK) {
394
+ in_link = true;
395
+ continue;
396
+ }
397
+
398
+ if (ev == CMARK_EVENT_ENTER && node->type == CMARK_NODE_TEXT) {
399
+ postprocess_text(parser, node, 0);
400
+ }
401
+ }
402
+
403
+ cmark_iter_free(iter);
404
+
405
+ return root;
406
+ }
407
+
408
+ cmark_syntax_extension *create_autolink_extension(void) {
409
+ cmark_syntax_extension *ext = cmark_syntax_extension_new("autolink");
410
+ cmark_llist *special_chars = NULL;
411
+
412
+ cmark_syntax_extension_set_match_inline_func(ext, match);
413
+ cmark_syntax_extension_set_postprocess_func(ext, postprocess);
414
+
415
+ cmark_mem *mem = cmark_get_default_mem_allocator();
416
+ special_chars = cmark_llist_append(mem, special_chars, (void *)':');
417
+ special_chars = cmark_llist_append(mem, special_chars, (void *)'w');
418
+ cmark_syntax_extension_set_special_inline_chars(ext, special_chars);
419
+
420
+ return ext;
421
+ }