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
+ #ifndef CMARK_INLINES_H
2
+ #define CMARK_INLINES_H
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ #include "references.h"
9
+
10
+ cmark_chunk cmark_clean_url(cmark_mem *mem, cmark_chunk *url);
11
+ cmark_chunk cmark_clean_title(cmark_mem *mem, cmark_chunk *title);
12
+
13
+ CMARK_EXPORT
14
+ void cmark_parse_inlines(cmark_parser *parser,
15
+ cmark_node *parent,
16
+ cmark_map *refmap,
17
+ int options);
18
+
19
+ bufsize_t cmark_parse_reference_inline(cmark_mem *mem, cmark_chunk *input,
20
+ cmark_map *refmap);
21
+
22
+ void cmark_inlines_add_special_character(unsigned char c, bool emphasis);
23
+ void cmark_inlines_remove_special_character(unsigned char c, bool emphasis);
24
+
25
+ #ifdef __cplusplus
26
+ }
27
+ #endif
28
+
29
+ #endif
@@ -0,0 +1,159 @@
1
+ #include <assert.h>
2
+ #include <stdlib.h>
3
+
4
+ #include "config.h"
5
+ #include "node.h"
6
+ #include "cmark.h"
7
+ #include "iterator.h"
8
+
9
+ cmark_iter *cmark_iter_new(cmark_node *root) {
10
+ if (root == NULL) {
11
+ return NULL;
12
+ }
13
+ cmark_mem *mem = root->content.mem;
14
+ cmark_iter *iter = (cmark_iter *)mem->calloc(1, sizeof(cmark_iter));
15
+ iter->mem = mem;
16
+ iter->root = root;
17
+ iter->cur.ev_type = CMARK_EVENT_NONE;
18
+ iter->cur.node = NULL;
19
+ iter->next.ev_type = CMARK_EVENT_ENTER;
20
+ iter->next.node = root;
21
+ return iter;
22
+ }
23
+
24
+ void cmark_iter_free(cmark_iter *iter) { iter->mem->free(iter); }
25
+
26
+ static bool S_is_leaf(cmark_node *node) {
27
+ switch (node->type) {
28
+ case CMARK_NODE_HTML_BLOCK:
29
+ case CMARK_NODE_THEMATIC_BREAK:
30
+ case CMARK_NODE_CODE_BLOCK:
31
+ case CMARK_NODE_TEXT:
32
+ case CMARK_NODE_SOFTBREAK:
33
+ case CMARK_NODE_LINEBREAK:
34
+ case CMARK_NODE_CODE:
35
+ case CMARK_NODE_HTML_INLINE:
36
+ return 1;
37
+ }
38
+ return 0;
39
+ }
40
+
41
+ cmark_event_type cmark_iter_next(cmark_iter *iter) {
42
+ cmark_event_type ev_type = iter->next.ev_type;
43
+ cmark_node *node = iter->next.node;
44
+
45
+ iter->cur.ev_type = ev_type;
46
+ iter->cur.node = node;
47
+
48
+ if (ev_type == CMARK_EVENT_DONE) {
49
+ return ev_type;
50
+ }
51
+
52
+ /* roll forward to next item, setting both fields */
53
+ if (ev_type == CMARK_EVENT_ENTER && !S_is_leaf(node)) {
54
+ if (node->first_child == NULL) {
55
+ /* stay on this node but exit */
56
+ iter->next.ev_type = CMARK_EVENT_EXIT;
57
+ } else {
58
+ iter->next.ev_type = CMARK_EVENT_ENTER;
59
+ iter->next.node = node->first_child;
60
+ }
61
+ } else if (node == iter->root) {
62
+ /* don't move past root */
63
+ iter->next.ev_type = CMARK_EVENT_DONE;
64
+ iter->next.node = NULL;
65
+ } else if (node->next) {
66
+ iter->next.ev_type = CMARK_EVENT_ENTER;
67
+ iter->next.node = node->next;
68
+ } else if (node->parent) {
69
+ iter->next.ev_type = CMARK_EVENT_EXIT;
70
+ iter->next.node = node->parent;
71
+ } else {
72
+ assert(false);
73
+ iter->next.ev_type = CMARK_EVENT_DONE;
74
+ iter->next.node = NULL;
75
+ }
76
+
77
+ return ev_type;
78
+ }
79
+
80
+ void cmark_iter_reset(cmark_iter *iter, cmark_node *current,
81
+ cmark_event_type event_type) {
82
+ iter->next.ev_type = event_type;
83
+ iter->next.node = current;
84
+ cmark_iter_next(iter);
85
+ }
86
+
87
+ cmark_node *cmark_iter_get_node(cmark_iter *iter) { return iter->cur.node; }
88
+
89
+ cmark_event_type cmark_iter_get_event_type(cmark_iter *iter) {
90
+ return iter->cur.ev_type;
91
+ }
92
+
93
+ cmark_node *cmark_iter_get_root(cmark_iter *iter) { return iter->root; }
94
+
95
+ void cmark_consolidate_text_nodes(cmark_node *root) {
96
+ if (root == NULL) {
97
+ return;
98
+ }
99
+ cmark_iter *iter = cmark_iter_new(root);
100
+ cmark_strbuf buf = CMARK_BUF_INIT(iter->mem);
101
+ cmark_event_type ev_type;
102
+ cmark_node *cur, *tmp, *next;
103
+
104
+ while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) {
105
+ cur = cmark_iter_get_node(iter);
106
+ if (ev_type == CMARK_EVENT_ENTER && cur->type == CMARK_NODE_TEXT &&
107
+ cur->next && cur->next->type == CMARK_NODE_TEXT) {
108
+ cmark_strbuf_clear(&buf);
109
+ cmark_strbuf_put(&buf, cur->as.literal.data, cur->as.literal.len);
110
+ tmp = cur->next;
111
+ while (tmp && tmp->type == CMARK_NODE_TEXT) {
112
+ cmark_iter_next(iter); // advance pointer
113
+ cmark_strbuf_put(&buf, tmp->as.literal.data, tmp->as.literal.len);
114
+ cur->end_column = tmp->end_column;
115
+ next = tmp->next;
116
+ cmark_node_free(tmp);
117
+ tmp = next;
118
+ }
119
+ cmark_chunk_free(iter->mem, &cur->as.literal);
120
+ cur->as.literal = cmark_chunk_buf_detach(&buf);
121
+ }
122
+ }
123
+
124
+ cmark_strbuf_free(&buf);
125
+ cmark_iter_free(iter);
126
+ }
127
+
128
+ void cmark_node_own(cmark_node *root) {
129
+ if (root == NULL) {
130
+ return;
131
+ }
132
+ cmark_iter *iter = cmark_iter_new(root);
133
+ cmark_event_type ev_type;
134
+ cmark_node *cur;
135
+
136
+ while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) {
137
+ cur = cmark_iter_get_node(iter);
138
+ if (ev_type == CMARK_EVENT_ENTER) {
139
+ switch (cur->type) {
140
+ case CMARK_NODE_TEXT:
141
+ case CMARK_NODE_HTML_INLINE:
142
+ case CMARK_NODE_CODE:
143
+ case CMARK_NODE_HTML_BLOCK:
144
+ cmark_chunk_to_cstr(iter->mem, &cur->as.literal);
145
+ break;
146
+ case CMARK_NODE_LINK:
147
+ cmark_chunk_to_cstr(iter->mem, &cur->as.link.url);
148
+ cmark_chunk_to_cstr(iter->mem, &cur->as.link.title);
149
+ break;
150
+ case CMARK_NODE_CUSTOM_INLINE:
151
+ cmark_chunk_to_cstr(iter->mem, &cur->as.custom.on_enter);
152
+ cmark_chunk_to_cstr(iter->mem, &cur->as.custom.on_exit);
153
+ break;
154
+ }
155
+ }
156
+ }
157
+
158
+ cmark_iter_free(iter);
159
+ }
@@ -0,0 +1,27 @@
1
+ #ifndef CMARK_ITERATOR_H
2
+ #define CMARK_ITERATOR_H
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ #include "cmark.h"
9
+ #include "memory.h"
10
+
11
+ typedef struct {
12
+ cmark_event_type ev_type;
13
+ cmark_node *node;
14
+ } cmark_iter_state;
15
+
16
+ struct cmark_iter {
17
+ cmark_mem *mem;
18
+ cmark_node *root;
19
+ cmark_iter_state cur;
20
+ cmark_iter_state next;
21
+ };
22
+
23
+ #ifdef __cplusplus
24
+ }
25
+ #endif
26
+
27
+ #endif
@@ -0,0 +1,466 @@
1
+ #include <stdlib.h>
2
+ #include <stdio.h>
3
+ #include <string.h>
4
+ #include <assert.h>
5
+
6
+ #include "config.h"
7
+ #include "cmark.h"
8
+ #include "node.h"
9
+ #include "buffer.h"
10
+ #include "utf8.h"
11
+ #include "scanners.h"
12
+ #include "render.h"
13
+ #include "syntax_extension.h"
14
+
15
+ #define OUT(s, wrap, escaping) renderer->out(renderer, node, s, wrap, escaping)
16
+ #define LIT(s) renderer->out(renderer, node, s, false, LITERAL)
17
+ #define CR() renderer->cr(renderer)
18
+ #define BLANKLINE() renderer->blankline(renderer)
19
+ #define LIST_NUMBER_STRING_SIZE 20
20
+
21
+ static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_node *node,
22
+ cmark_escaping escape,
23
+ int32_t c, unsigned char nextc) {
24
+ if (escape == LITERAL) {
25
+ cmark_render_code_point(renderer, c);
26
+ return;
27
+ }
28
+
29
+ switch (c) {
30
+ case 123: // '{'
31
+ case 125: // '}'
32
+ case 35: // '#'
33
+ case 37: // '%'
34
+ case 38: // '&'
35
+ cmark_render_ascii(renderer, "\\");
36
+ cmark_render_code_point(renderer, c);
37
+ break;
38
+ case 36: // '$'
39
+ case 95: // '_'
40
+ if (escape == NORMAL) {
41
+ cmark_render_ascii(renderer, "\\");
42
+ }
43
+ cmark_render_code_point(renderer, c);
44
+ break;
45
+ case 45: // '-'
46
+ if (nextc == 45) { // prevent ligature
47
+ cmark_render_ascii(renderer, "-{}");
48
+ } else {
49
+ cmark_render_ascii(renderer, "-");
50
+ }
51
+ break;
52
+ case 126: // '~'
53
+ if (escape == NORMAL) {
54
+ cmark_render_ascii(renderer, "\\textasciitilde{}");
55
+ } else {
56
+ cmark_render_code_point(renderer, c);
57
+ }
58
+ break;
59
+ case 94: // '^'
60
+ cmark_render_ascii(renderer, "\\^{}");
61
+ break;
62
+ case 92: // '\\'
63
+ if (escape == URL) {
64
+ // / acts as path sep even on windows:
65
+ cmark_render_ascii(renderer, "/");
66
+ } else {
67
+ cmark_render_ascii(renderer, "\\textbackslash{}");
68
+ }
69
+ break;
70
+ case 124: // '|'
71
+ cmark_render_ascii(renderer, "\\textbar{}");
72
+ break;
73
+ case 60: // '<'
74
+ cmark_render_ascii(renderer, "\\textless{}");
75
+ break;
76
+ case 62: // '>'
77
+ cmark_render_ascii(renderer, "\\textgreater{}");
78
+ break;
79
+ case 91: // '['
80
+ case 93: // ']'
81
+ cmark_render_ascii(renderer, "{");
82
+ cmark_render_code_point(renderer, c);
83
+ cmark_render_ascii(renderer, "}");
84
+ break;
85
+ case 34: // '"'
86
+ cmark_render_ascii(renderer, "\\textquotedbl{}");
87
+ // requires \usepackage[T1]{fontenc}
88
+ break;
89
+ case 39: // '\''
90
+ cmark_render_ascii(renderer, "\\textquotesingle{}");
91
+ // requires \usepackage{textcomp}
92
+ break;
93
+ case 160: // nbsp
94
+ cmark_render_ascii(renderer, "~");
95
+ break;
96
+ case 8230: // hellip
97
+ cmark_render_ascii(renderer, "\\ldots{}");
98
+ break;
99
+ case 8216: // lsquo
100
+ if (escape == NORMAL) {
101
+ cmark_render_ascii(renderer, "`");
102
+ } else {
103
+ cmark_render_code_point(renderer, c);
104
+ }
105
+ break;
106
+ case 8217: // rsquo
107
+ if (escape == NORMAL) {
108
+ cmark_render_ascii(renderer, "\'");
109
+ } else {
110
+ cmark_render_code_point(renderer, c);
111
+ }
112
+ break;
113
+ case 8220: // ldquo
114
+ if (escape == NORMAL) {
115
+ cmark_render_ascii(renderer, "``");
116
+ } else {
117
+ cmark_render_code_point(renderer, c);
118
+ }
119
+ break;
120
+ case 8221: // rdquo
121
+ if (escape == NORMAL) {
122
+ cmark_render_ascii(renderer, "''");
123
+ } else {
124
+ cmark_render_code_point(renderer, c);
125
+ }
126
+ break;
127
+ case 8212: // emdash
128
+ if (escape == NORMAL) {
129
+ cmark_render_ascii(renderer, "---");
130
+ } else {
131
+ cmark_render_code_point(renderer, c);
132
+ }
133
+ break;
134
+ case 8211: // endash
135
+ if (escape == NORMAL) {
136
+ cmark_render_ascii(renderer, "--");
137
+ } else {
138
+ cmark_render_code_point(renderer, c);
139
+ }
140
+ break;
141
+ default:
142
+ cmark_render_code_point(renderer, c);
143
+ }
144
+ }
145
+
146
+ typedef enum {
147
+ NO_LINK,
148
+ URL_AUTOLINK,
149
+ EMAIL_AUTOLINK,
150
+ NORMAL_LINK,
151
+ INTERNAL_LINK
152
+ } link_type;
153
+
154
+ static link_type get_link_type(cmark_node *node) {
155
+ size_t title_len, url_len;
156
+ cmark_node *link_text;
157
+ char *realurl;
158
+ int realurllen;
159
+ bool isemail = false;
160
+
161
+ if (node->type != CMARK_NODE_LINK) {
162
+ return NO_LINK;
163
+ }
164
+
165
+ const char *url = cmark_node_get_url(node);
166
+ cmark_chunk url_chunk = cmark_chunk_literal(url);
167
+
168
+ if (url && *url == '#') {
169
+ return INTERNAL_LINK;
170
+ }
171
+
172
+ url_len = strlen(url);
173
+ if (url_len == 0 || scan_scheme(&url_chunk, 0) == 0) {
174
+ return NO_LINK;
175
+ }
176
+
177
+ const char *title = cmark_node_get_title(node);
178
+ title_len = strlen(title);
179
+ // if it has a title, we can't treat it as an autolink:
180
+ if (title_len == 0) {
181
+
182
+ link_text = node->first_child;
183
+ cmark_consolidate_text_nodes(link_text);
184
+
185
+ if (!link_text)
186
+ return NO_LINK;
187
+
188
+ realurl = (char *)url;
189
+ realurllen = (int)url_len;
190
+ if (strncmp(realurl, "mailto:", 7) == 0) {
191
+ realurl += 7;
192
+ realurllen -= 7;
193
+ isemail = true;
194
+ }
195
+ if (realurllen == link_text->as.literal.len &&
196
+ strncmp(realurl, (char *)link_text->as.literal.data,
197
+ link_text->as.literal.len) == 0) {
198
+ if (isemail) {
199
+ return EMAIL_AUTOLINK;
200
+ } else {
201
+ return URL_AUTOLINK;
202
+ }
203
+ }
204
+ }
205
+
206
+ return NORMAL_LINK;
207
+ }
208
+
209
+ static int S_get_enumlevel(cmark_node *node) {
210
+ int enumlevel = 0;
211
+ cmark_node *tmp = node;
212
+ while (tmp) {
213
+ if (tmp->type == CMARK_NODE_LIST &&
214
+ cmark_node_get_list_type(node) == CMARK_ORDERED_LIST) {
215
+ enumlevel++;
216
+ }
217
+ tmp = tmp->parent;
218
+ }
219
+ return enumlevel;
220
+ }
221
+
222
+ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
223
+ cmark_event_type ev_type, int options) {
224
+ int list_number;
225
+ int enumlevel;
226
+ char list_number_string[LIST_NUMBER_STRING_SIZE];
227
+ bool entering = (ev_type == CMARK_EVENT_ENTER);
228
+ cmark_list_type list_type;
229
+ bool allow_wrap = renderer->width > 0 && !(CMARK_OPT_NOBREAKS & options);
230
+
231
+ if (node->extension && node->extension->latex_render_func) {
232
+ node->extension->latex_render_func(node->extension, renderer, node, ev_type, options);
233
+ return 1;
234
+ }
235
+
236
+ switch (node->type) {
237
+ case CMARK_NODE_DOCUMENT:
238
+ break;
239
+
240
+ case CMARK_NODE_BLOCK_QUOTE:
241
+ if (entering) {
242
+ LIT("\\begin{quote}");
243
+ CR();
244
+ } else {
245
+ LIT("\\end{quote}");
246
+ BLANKLINE();
247
+ }
248
+ break;
249
+
250
+ case CMARK_NODE_LIST:
251
+ list_type = cmark_node_get_list_type(node);
252
+ if (entering) {
253
+ LIT("\\begin{");
254
+ LIT(list_type == CMARK_ORDERED_LIST ? "enumerate" : "itemize");
255
+ LIT("}");
256
+ CR();
257
+ list_number = cmark_node_get_list_start(node);
258
+ if (list_number > 1) {
259
+ enumlevel = S_get_enumlevel(node);
260
+ // latex normally supports only five levels
261
+ if (enumlevel >= 1 && enumlevel <= 5) {
262
+ snprintf(list_number_string, LIST_NUMBER_STRING_SIZE, "%d",
263
+ list_number);
264
+ LIT("\\setcounter{enum");
265
+ switch (enumlevel) {
266
+ case 1: LIT("i"); break;
267
+ case 2: LIT("ii"); break;
268
+ case 3: LIT("iii"); break;
269
+ case 4: LIT("iv"); break;
270
+ case 5: LIT("v"); break;
271
+ default: LIT("i"); break;
272
+ }
273
+ LIT("}{");
274
+ OUT(list_number_string, false, NORMAL);
275
+ LIT("}");
276
+ }
277
+ CR();
278
+ }
279
+ } else {
280
+ LIT("\\end{");
281
+ LIT(list_type == CMARK_ORDERED_LIST ? "enumerate" : "itemize");
282
+ LIT("}");
283
+ BLANKLINE();
284
+ }
285
+ break;
286
+
287
+ case CMARK_NODE_ITEM:
288
+ if (entering) {
289
+ LIT("\\item ");
290
+ } else {
291
+ CR();
292
+ }
293
+ break;
294
+
295
+ case CMARK_NODE_HEADING:
296
+ if (entering) {
297
+ switch (cmark_node_get_heading_level(node)) {
298
+ case 1:
299
+ LIT("\\section");
300
+ break;
301
+ case 2:
302
+ LIT("\\subsection");
303
+ break;
304
+ case 3:
305
+ LIT("\\subsubsection");
306
+ break;
307
+ case 4:
308
+ LIT("\\paragraph");
309
+ break;
310
+ case 5:
311
+ LIT("\\subparagraph");
312
+ break;
313
+ }
314
+ LIT("{");
315
+ } else {
316
+ LIT("}");
317
+ BLANKLINE();
318
+ }
319
+ break;
320
+
321
+ case CMARK_NODE_CODE_BLOCK:
322
+ CR();
323
+ LIT("\\begin{verbatim}");
324
+ CR();
325
+ OUT(cmark_node_get_literal(node), false, LITERAL);
326
+ CR();
327
+ LIT("\\end{verbatim}");
328
+ BLANKLINE();
329
+ break;
330
+
331
+ case CMARK_NODE_HTML_BLOCK:
332
+ break;
333
+
334
+ case CMARK_NODE_CUSTOM_BLOCK:
335
+ CR();
336
+ OUT(entering ? cmark_node_get_on_enter(node) : cmark_node_get_on_exit(node),
337
+ false, LITERAL);
338
+ CR();
339
+ break;
340
+
341
+ case CMARK_NODE_THEMATIC_BREAK:
342
+ BLANKLINE();
343
+ LIT("\\begin{center}\\rule{0.5\\linewidth}{\\linethickness}\\end{center}");
344
+ BLANKLINE();
345
+ break;
346
+
347
+ case CMARK_NODE_PARAGRAPH:
348
+ if (!entering) {
349
+ BLANKLINE();
350
+ }
351
+ break;
352
+
353
+ case CMARK_NODE_TEXT:
354
+ OUT(cmark_node_get_literal(node), allow_wrap, NORMAL);
355
+ break;
356
+
357
+ case CMARK_NODE_LINEBREAK:
358
+ LIT("\\\\");
359
+ CR();
360
+ break;
361
+
362
+ case CMARK_NODE_SOFTBREAK:
363
+ if (options & CMARK_OPT_HARDBREAKS) {
364
+ LIT("\\\\");
365
+ CR();
366
+ } else if (renderer->width == 0 && !(CMARK_OPT_NOBREAKS & options)) {
367
+ CR();
368
+ } else {
369
+ OUT(" ", allow_wrap, NORMAL);
370
+ }
371
+ break;
372
+
373
+ case CMARK_NODE_CODE:
374
+ LIT("\\texttt{");
375
+ OUT(cmark_node_get_literal(node), false, NORMAL);
376
+ LIT("}");
377
+ break;
378
+
379
+ case CMARK_NODE_HTML_INLINE:
380
+ break;
381
+
382
+ case CMARK_NODE_CUSTOM_INLINE:
383
+ OUT(entering ? cmark_node_get_on_enter(node) : cmark_node_get_on_exit(node),
384
+ false, LITERAL);
385
+ break;
386
+
387
+ case CMARK_NODE_STRONG:
388
+ if (entering) {
389
+ LIT("\\textbf{");
390
+ } else {
391
+ LIT("}");
392
+ }
393
+ break;
394
+
395
+ case CMARK_NODE_EMPH:
396
+ if (entering) {
397
+ LIT("\\emph{");
398
+ } else {
399
+ LIT("}");
400
+ }
401
+ break;
402
+
403
+ case CMARK_NODE_LINK:
404
+ if (entering) {
405
+ const char *url = cmark_node_get_url(node);
406
+ // requires \usepackage{hyperref}
407
+ switch (get_link_type(node)) {
408
+ case URL_AUTOLINK:
409
+ LIT("\\url{");
410
+ OUT(url, false, URL);
411
+ LIT("}");
412
+ return 0; // Don't process further nodes to avoid double-rendering artefacts
413
+ case EMAIL_AUTOLINK:
414
+ LIT("\\href{");
415
+ OUT(url, false, URL);
416
+ LIT("}\\nolinkurl{");
417
+ break;
418
+ case NORMAL_LINK:
419
+ LIT("\\href{");
420
+ OUT(url, false, URL);
421
+ LIT("}{");
422
+ break;
423
+ case INTERNAL_LINK:
424
+ LIT("\\protect\\hyperlink{");
425
+ OUT(url + 1, false, URL);
426
+ LIT("}{");
427
+ break;
428
+ case NO_LINK:
429
+ LIT("{"); // error?
430
+ }
431
+ } else {
432
+ LIT("}");
433
+ }
434
+
435
+ break;
436
+
437
+ case CMARK_NODE_IMAGE:
438
+ if (entering) {
439
+ LIT("\\protect\\includegraphics{");
440
+ // requires \include{graphicx}
441
+ OUT(cmark_node_get_url(node), false, URL);
442
+ LIT("}");
443
+ return 0;
444
+ }
445
+ break;
446
+
447
+ case CMARK_NODE_FOOTNOTE_DEFINITION:
448
+ case CMARK_NODE_FOOTNOTE_REFERENCE:
449
+ // TODO
450
+ break;
451
+
452
+ default:
453
+ assert(false);
454
+ break;
455
+ }
456
+
457
+ return 1;
458
+ }
459
+
460
+ char *cmark_render_latex(cmark_node *root, int options, int width) {
461
+ return cmark_render_latex_with_mem(root, options, width, cmark_node_mem(root));
462
+ }
463
+
464
+ char *cmark_render_latex_with_mem(cmark_node *root, int options, int width, cmark_mem *mem) {
465
+ return cmark_render(mem, root, options, width, outc, S_render_node);
466
+ }