commonmarker 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of commonmarker might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +119 -0
- data/Rakefile +39 -0
- data/bin/commonmarker +41 -0
- data/commonmarker.gemspec +30 -0
- data/ext/commonmarker/cmark/CMakeLists.txt +25 -0
- data/ext/commonmarker/cmark/COPYING +192 -0
- data/ext/commonmarker/cmark/FindAsan.cmake +74 -0
- data/ext/commonmarker/cmark/Makefile +170 -0
- data/ext/commonmarker/cmark/Makefile.nmake +36 -0
- data/ext/commonmarker/cmark/README.md +169 -0
- data/ext/commonmarker/cmark/api_test/CMakeLists.txt +25 -0
- data/ext/commonmarker/cmark/api_test/cplusplus.cpp +15 -0
- data/ext/commonmarker/cmark/api_test/cplusplus.h +17 -0
- data/ext/commonmarker/cmark/api_test/harness.c +102 -0
- data/ext/commonmarker/cmark/api_test/harness.h +42 -0
- data/ext/commonmarker/cmark/api_test/main.c +700 -0
- data/ext/commonmarker/cmark/appveyor.yml +15 -0
- data/ext/commonmarker/cmark/bench/statistics.py +595 -0
- data/ext/commonmarker/cmark/bench/stats.py +19 -0
- data/ext/commonmarker/cmark/benchmarks.md +33 -0
- data/ext/commonmarker/cmark/build/CMakeCache.txt +362 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CMakeCCompiler.cmake +63 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CMakeCXXCompiler.cmake +64 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CMakeDetermineCompilerABI_C.bin +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CMakeDetermineCompilerABI_CXX.bin +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CMakeSystem.cmake +15 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CompilerIdC/CMakeCCompilerId.c +499 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CompilerIdC/a.out +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CompilerIdCXX/CMakeCXXCompilerId.cpp +489 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.2.2/CompilerIdCXX/a.out +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/CMakeError.log +30 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/CMakeOutput.log +598 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/Makefile.cmake +77 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/Makefile2 +268 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/TargetDirectories.txt +4 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/cmake.check_cache +1 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.bin +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.c +34 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.cxx +405 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/CTestTestfile.cmake +10 -0
- data/ext/commonmarker/cmark/build/Makefile +237 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/C.includecache +92 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/CXX.includecache +36 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/DependInfo.cmake +29 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/build.make +155 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/cmake_clean.cmake +12 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/cplusplus.cpp.o +0 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/depend.internal +25 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/depend.make +25 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/flags.make +13 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/harness.c.o +0 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/link.txt +1 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/main.c.o +0 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/progress.make +4 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/api_test/Makefile +277 -0
- data/ext/commonmarker/cmark/build/api_test/api_test +0 -0
- data/ext/commonmarker/cmark/build/api_test/cmake_install.cmake +29 -0
- data/ext/commonmarker/cmark/build/cmake_install.cmake +48 -0
- data/ext/commonmarker/cmark/build/man/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/man/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/man/Makefile +181 -0
- data/ext/commonmarker/cmark/build/man/cmake_install.cmake +37 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/C.includecache +422 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/DependInfo.cmake +39 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/blocks.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/buffer.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/build.make +544 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/cmake_clean.cmake +27 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/cmark.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/cmark_ctype.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/commonmark.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/depend.internal +177 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/depend.make +177 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/flags.make +8 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/houdini_href_e.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/houdini_html_e.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/houdini_html_u.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/html.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/inlines.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/iterator.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/link.txt +1 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/main.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/man.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/node.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/progress.make +19 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/references.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/scanners.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/utf8.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/xml.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/C.includecache +394 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/DependInfo.cmake +44 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/blocks.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/buffer.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/build.make +522 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/cmake_clean.cmake +27 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/cmark.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/cmark_ctype.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/commonmark.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/depend.internal +169 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/depend.make +169 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/flags.make +8 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/houdini_href_e.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/houdini_html_e.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/houdini_html_u.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/html.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/inlines.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/iterator.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/link.txt +1 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/man.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/node.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/progress.make +18 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/references.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/scanners.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/utf8.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/xml.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/C.includecache +394 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/DependInfo.cmake +38 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/blocks.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/buffer.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/build.make +519 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmake_clean.cmake +26 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmake_clean_target.cmake +3 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmark.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmark_ctype.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/commonmark.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/depend.internal +169 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/depend.make +169 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/flags.make +8 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/houdini_href_e.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/houdini_html_e.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/houdini_html_u.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/html.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/inlines.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/iterator.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/link.txt +2 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/man.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/node.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/progress.make +18 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/references.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/scanners.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/utf8.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/xml.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/src/Makefile +814 -0
- data/ext/commonmarker/cmark/build/src/cmake_install.cmake +69 -0
- data/ext/commonmarker/cmark/build/src/cmark +0 -0
- data/ext/commonmarker/cmark/build/src/cmark_export.h +41 -0
- data/ext/commonmarker/cmark/build/src/cmark_version.h +7 -0
- data/ext/commonmarker/cmark/build/src/config.h +23 -0
- data/ext/commonmarker/cmark/build/src/libcmark.0.19.0.dylib +0 -0
- data/ext/commonmarker/cmark/build/src/libcmark.a +0 -0
- data/ext/commonmarker/cmark/build/src/libcmark.dylib +0 -0
- data/ext/commonmarker/cmark/build/src/libcmark.pc +10 -0
- data/ext/commonmarker/cmark/build/testdir/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/testdir/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/testdir/CTestTestfile.cmake +12 -0
- data/ext/commonmarker/cmark/build/testdir/Makefile +181 -0
- data/ext/commonmarker/cmark/build/testdir/cmake_install.cmake +29 -0
- data/ext/commonmarker/cmark/changelog.txt +153 -0
- data/ext/commonmarker/cmark/data/CaseFolding-3.2.0.txt +912 -0
- data/ext/commonmarker/cmark/man/CMakeLists.txt +8 -0
- data/ext/commonmarker/cmark/man/make_man_page.py +131 -0
- data/ext/commonmarker/cmark/man/man1/cmark.1 +54 -0
- data/ext/commonmarker/cmark/man/man3/cmark.3 +583 -0
- data/ext/commonmarker/cmark/nmake.bat +1 -0
- data/ext/commonmarker/cmark/src/CMakeLists.txt +166 -0
- data/ext/commonmarker/cmark/src/bench.h +27 -0
- data/ext/commonmarker/cmark/src/blocks.c +887 -0
- data/ext/commonmarker/cmark/src/buffer.c +381 -0
- data/ext/commonmarker/cmark/src/buffer.h +113 -0
- data/ext/commonmarker/cmark/src/case_fold_switch.inc +2637 -0
- data/ext/commonmarker/cmark/src/chunk.h +110 -0
- data/ext/commonmarker/cmark/src/cmark.c +24 -0
- data/ext/commonmarker/cmark/src/cmark.h +565 -0
- data/ext/commonmarker/cmark/src/cmark_ctype.c +53 -0
- data/ext/commonmarker/cmark/src/cmark_ctype.h +24 -0
- data/ext/commonmarker/cmark/src/cmark_version.h.in +7 -0
- data/ext/commonmarker/cmark/src/commonmark.c +607 -0
- data/ext/commonmarker/cmark/src/config.h.in +23 -0
- data/ext/commonmarker/cmark/src/debug.h +36 -0
- data/ext/commonmarker/cmark/src/houdini.h +52 -0
- data/ext/commonmarker/cmark/src/houdini_href_e.c +107 -0
- data/ext/commonmarker/cmark/src/houdini_html_e.c +81 -0
- data/ext/commonmarker/cmark/src/houdini_html_u.c +116 -0
- data/ext/commonmarker/cmark/src/html.c +322 -0
- data/ext/commonmarker/cmark/src/html_unescape.gperf +2130 -0
- data/ext/commonmarker/cmark/src/html_unescape.h +13375 -0
- data/ext/commonmarker/cmark/src/inlines.c +1147 -0
- data/ext/commonmarker/cmark/src/inlines.h +19 -0
- data/ext/commonmarker/cmark/src/iterator.c +148 -0
- data/ext/commonmarker/cmark/src/iterator.h +25 -0
- data/ext/commonmarker/cmark/src/libcmark.pc.in +10 -0
- data/ext/commonmarker/cmark/src/main.c +191 -0
- data/ext/commonmarker/cmark/src/man.c +287 -0
- data/ext/commonmarker/cmark/src/node.c +873 -0
- data/ext/commonmarker/cmark/src/node.h +82 -0
- data/ext/commonmarker/cmark/src/parser.h +29 -0
- data/ext/commonmarker/cmark/src/references.c +154 -0
- data/ext/commonmarker/cmark/src/references.h +37 -0
- data/ext/commonmarker/cmark/src/scanners.c +15291 -0
- data/ext/commonmarker/cmark/src/scanners.h +41 -0
- data/ext/commonmarker/cmark/src/scanners.re +247 -0
- data/ext/commonmarker/cmark/src/utf8.c +452 -0
- data/ext/commonmarker/cmark/src/utf8.h +22 -0
- data/ext/commonmarker/cmark/src/xml.c +170 -0
- data/ext/commonmarker/cmark/test/CMakeLists.txt +53 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/asterisk +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/attr_generic +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/attr_href +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/attr_xml_lang +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/attr_xmlns +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/backslash +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/backtick +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/colon +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/dashes +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/double_quote +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/entity_builtin +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/entity_decimal +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/entity_external +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/entity_hex +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/equals +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/exclamation +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/greater_than +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/hash +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/hyphen +0 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/indent +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/left_bracket +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/left_paren +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/less_than +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/plus +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/right_bracket +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/right_paren +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/single_quote +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/string_any +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/string_brackets +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/string_cdata +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/string_dashes +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/string_empty_dblquotes +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/string_empty_quotes +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/string_idrefs +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/string_parentheses +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/string_pcdata +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/tag_cdata +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/tag_close +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/tag_doctype +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/tag_element +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/tag_entity +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/tag_notation +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/tag_open +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/tag_open_close +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/tag_open_exclamation +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/tag_open_q +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/tag_sq2_close +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/tag_xml_q +1 -0
- data/ext/commonmarker/cmark/test/afl_dictionary/underscore +1 -0
- data/ext/commonmarker/cmark/test/afl_test_cases/test.md +36 -0
- data/ext/commonmarker/cmark/test/cmark.py +40 -0
- data/ext/commonmarker/cmark/test/normalize.py +179 -0
- data/ext/commonmarker/cmark/test/pathological_tests.py +63 -0
- data/ext/commonmarker/cmark/test/roundtrip.sh +2 -0
- data/ext/commonmarker/cmark/test/smart_punct.txt +96 -0
- data/ext/commonmarker/cmark/test/spec.txt +7505 -0
- data/ext/commonmarker/cmark/test/spec_tests.py +139 -0
- data/ext/commonmarker/cmark/toolchain-mingw32.cmake +17 -0
- data/ext/commonmarker/cmark/tools/mkcasefold.pl +22 -0
- data/ext/commonmarker/cmark/wrappers/wrapper.lua +239 -0
- data/ext/commonmarker/cmark/wrappers/wrapper.py +37 -0
- data/ext/commonmarker/cmark/wrappers/wrapper.rb +15 -0
- data/ext/commonmarker/cmark/wrappers/wrapper.rkt +190 -0
- data/ext/commonmarker/commonmarker.c +165 -0
- data/ext/commonmarker/commonmarker.h +11 -0
- data/ext/commonmarker/extconf.rb +18 -0
- data/lib/commonmarker/config.rb +20 -0
- data/lib/commonmarker/version.rb +3 -0
- data/lib/commonmarker.rb +588 -0
- data/test/benchmark.rb +30 -0
- data/test/spec_tests.json +4074 -0
- data/test/test_basics.rb +44 -0
- data/test/test_helper.rb +5 -0
- data/test/test_maliciousness.rb +9 -0
- data/test/test_pathological_inputs.rb +52 -0
- data/test/test_spec.rb +20 -0
- metadata +399 -0
@@ -0,0 +1,452 @@
|
|
1
|
+
#include <stdlib.h>
|
2
|
+
#include <stdint.h>
|
3
|
+
#include <assert.h>
|
4
|
+
|
5
|
+
#include "cmark_ctype.h"
|
6
|
+
#include "utf8.h"
|
7
|
+
|
8
|
+
static const int8_t utf8proc_utf8class[256] = {
|
9
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
10
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
11
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
12
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
13
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
14
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
15
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
16
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
17
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
18
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
19
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
20
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
21
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
22
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
23
|
+
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
24
|
+
4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0
|
25
|
+
};
|
26
|
+
|
27
|
+
static void encode_unknown(cmark_strbuf *buf)
|
28
|
+
{
|
29
|
+
static const uint8_t repl[] = {239, 191, 189};
|
30
|
+
cmark_strbuf_put(buf, repl, 3);
|
31
|
+
}
|
32
|
+
|
33
|
+
static int utf8proc_charlen(const uint8_t *str, int str_len)
|
34
|
+
{
|
35
|
+
int length, i;
|
36
|
+
|
37
|
+
if (!str_len)
|
38
|
+
return 0;
|
39
|
+
|
40
|
+
length = utf8proc_utf8class[str[0]];
|
41
|
+
|
42
|
+
if (!length)
|
43
|
+
return -1;
|
44
|
+
|
45
|
+
if (str_len >= 0 && length > str_len)
|
46
|
+
return -str_len;
|
47
|
+
|
48
|
+
for (i = 1; i < length; i++) {
|
49
|
+
if ((str[i] & 0xC0) != 0x80)
|
50
|
+
return -i;
|
51
|
+
}
|
52
|
+
|
53
|
+
return length;
|
54
|
+
}
|
55
|
+
|
56
|
+
// Validate a single UTF-8 character according to RFC 3629.
|
57
|
+
static int utf8proc_valid(const uint8_t *str, int str_len)
|
58
|
+
{
|
59
|
+
int length = utf8proc_charlen(str, str_len);
|
60
|
+
|
61
|
+
if (length <= 0)
|
62
|
+
return length;
|
63
|
+
|
64
|
+
switch (length) {
|
65
|
+
case 1:
|
66
|
+
if (str[0] == 0x00) {
|
67
|
+
// ASCII NUL is technically valid but rejected
|
68
|
+
// for security reasons.
|
69
|
+
return -length;
|
70
|
+
}
|
71
|
+
break;
|
72
|
+
|
73
|
+
case 2:
|
74
|
+
if (str[0] < 0xC2) {
|
75
|
+
// Overlong
|
76
|
+
return -length;
|
77
|
+
}
|
78
|
+
break;
|
79
|
+
|
80
|
+
case 3:
|
81
|
+
if (str[0] == 0xE0) {
|
82
|
+
if (str[1] < 0xA0) {
|
83
|
+
// Overlong
|
84
|
+
return -length;
|
85
|
+
}
|
86
|
+
} else if (str[0] == 0xED) {
|
87
|
+
if (str[1] >= 0xA0) {
|
88
|
+
// Surrogate
|
89
|
+
return -length;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
break;
|
93
|
+
|
94
|
+
case 4:
|
95
|
+
if (str[0] == 0xF0) {
|
96
|
+
if (str[1] < 0x90) {
|
97
|
+
// Overlong
|
98
|
+
return -length;
|
99
|
+
}
|
100
|
+
} else if (str[0] >= 0xF4) {
|
101
|
+
if (str[0] > 0xF4 || str[1] >= 0x90) {
|
102
|
+
// Above 0x10FFFF
|
103
|
+
return -length;
|
104
|
+
}
|
105
|
+
}
|
106
|
+
break;
|
107
|
+
}
|
108
|
+
|
109
|
+
return length;
|
110
|
+
}
|
111
|
+
|
112
|
+
void utf8proc_detab(cmark_strbuf *ob, const uint8_t *line, size_t size)
|
113
|
+
{
|
114
|
+
static const uint8_t whitespace[] = " ";
|
115
|
+
|
116
|
+
size_t i = 0, tab = 0;
|
117
|
+
|
118
|
+
while (i < size) {
|
119
|
+
size_t org = i;
|
120
|
+
|
121
|
+
while (i < size && line[i] != '\t' && line[i] != '\0'
|
122
|
+
&& line[i] < 0x80) {
|
123
|
+
i++;
|
124
|
+
tab++;
|
125
|
+
}
|
126
|
+
|
127
|
+
if (i > org)
|
128
|
+
cmark_strbuf_put(ob, line + org, i - org);
|
129
|
+
|
130
|
+
if (i >= size)
|
131
|
+
break;
|
132
|
+
|
133
|
+
if (line[i] == '\t') {
|
134
|
+
int numspaces = 4 - (tab % 4);
|
135
|
+
cmark_strbuf_put(ob, whitespace, numspaces);
|
136
|
+
i += 1;
|
137
|
+
tab += numspaces;
|
138
|
+
} else {
|
139
|
+
int charlen = utf8proc_valid(line + i, size - i);
|
140
|
+
|
141
|
+
if (charlen >= 0) {
|
142
|
+
cmark_strbuf_put(ob, line + i, charlen);
|
143
|
+
} else {
|
144
|
+
encode_unknown(ob);
|
145
|
+
charlen = -charlen;
|
146
|
+
}
|
147
|
+
|
148
|
+
i += charlen;
|
149
|
+
tab += 1;
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
int utf8proc_iterate(const uint8_t *str, int str_len, int32_t *dst)
|
155
|
+
{
|
156
|
+
int length;
|
157
|
+
int32_t uc = -1;
|
158
|
+
|
159
|
+
*dst = -1;
|
160
|
+
length = utf8proc_charlen(str, str_len);
|
161
|
+
if (length < 0)
|
162
|
+
return -1;
|
163
|
+
|
164
|
+
switch (length) {
|
165
|
+
case 1:
|
166
|
+
uc = str[0];
|
167
|
+
break;
|
168
|
+
case 2:
|
169
|
+
uc = ((str[0] & 0x1F) << 6) + (str[1] & 0x3F);
|
170
|
+
if (uc < 0x80) uc = -1;
|
171
|
+
break;
|
172
|
+
case 3:
|
173
|
+
uc = ((str[0] & 0x0F) << 12) + ((str[1] & 0x3F) << 6)
|
174
|
+
+ (str[2] & 0x3F);
|
175
|
+
if (uc < 0x800 || (uc >= 0xD800 && uc < 0xE000)) uc = -1;
|
176
|
+
break;
|
177
|
+
case 4:
|
178
|
+
uc = ((str[0] & 0x07) << 18) + ((str[1] & 0x3F) << 12)
|
179
|
+
+ ((str[2] & 0x3F) << 6) + (str[3] & 0x3F);
|
180
|
+
if (uc < 0x10000 || uc >= 0x110000) uc = -1;
|
181
|
+
break;
|
182
|
+
}
|
183
|
+
|
184
|
+
if (uc < 0)
|
185
|
+
return -1;
|
186
|
+
|
187
|
+
*dst = uc;
|
188
|
+
return length;
|
189
|
+
}
|
190
|
+
|
191
|
+
void utf8proc_encode_char(int32_t uc, cmark_strbuf *buf)
|
192
|
+
{
|
193
|
+
uint8_t dst[4];
|
194
|
+
int len = 0;
|
195
|
+
|
196
|
+
assert(uc >= 0);
|
197
|
+
|
198
|
+
if (uc < 0x80) {
|
199
|
+
dst[0] = uc;
|
200
|
+
len = 1;
|
201
|
+
} else if (uc < 0x800) {
|
202
|
+
dst[0] = 0xC0 + (uc >> 6);
|
203
|
+
dst[1] = 0x80 + (uc & 0x3F);
|
204
|
+
len = 2;
|
205
|
+
} else if (uc == 0xFFFF) {
|
206
|
+
dst[0] = 0xFF;
|
207
|
+
len = 1;
|
208
|
+
} else if (uc == 0xFFFE) {
|
209
|
+
dst[0] = 0xFE;
|
210
|
+
len = 1;
|
211
|
+
} else if (uc < 0x10000) {
|
212
|
+
dst[0] = 0xE0 + (uc >> 12);
|
213
|
+
dst[1] = 0x80 + ((uc >> 6) & 0x3F);
|
214
|
+
dst[2] = 0x80 + (uc & 0x3F);
|
215
|
+
len = 3;
|
216
|
+
} else if (uc < 0x110000) {
|
217
|
+
dst[0] = 0xF0 + (uc >> 18);
|
218
|
+
dst[1] = 0x80 + ((uc >> 12) & 0x3F);
|
219
|
+
dst[2] = 0x80 + ((uc >> 6) & 0x3F);
|
220
|
+
dst[3] = 0x80 + (uc & 0x3F);
|
221
|
+
len = 4;
|
222
|
+
} else {
|
223
|
+
encode_unknown(buf);
|
224
|
+
return;
|
225
|
+
}
|
226
|
+
|
227
|
+
cmark_strbuf_put(buf, dst, len);
|
228
|
+
}
|
229
|
+
|
230
|
+
void utf8proc_case_fold(cmark_strbuf *dest, const uint8_t *str, int len)
|
231
|
+
{
|
232
|
+
int32_t c;
|
233
|
+
|
234
|
+
#define bufpush(x) \
|
235
|
+
utf8proc_encode_char(x, dest)
|
236
|
+
|
237
|
+
while (len > 0) {
|
238
|
+
int char_len = utf8proc_iterate(str, len, &c);
|
239
|
+
|
240
|
+
if (char_len >= 0) {
|
241
|
+
#include "case_fold_switch.inc"
|
242
|
+
} else {
|
243
|
+
encode_unknown(dest);
|
244
|
+
char_len = -char_len;
|
245
|
+
}
|
246
|
+
|
247
|
+
str += char_len;
|
248
|
+
len -= char_len;
|
249
|
+
}
|
250
|
+
}
|
251
|
+
|
252
|
+
// matches anything in the Zs class, plus LF, CR, TAB, FF.
|
253
|
+
int utf8proc_is_space(int32_t uc)
|
254
|
+
{
|
255
|
+
return (uc == 9 ||
|
256
|
+
uc == 10 ||
|
257
|
+
uc == 12 ||
|
258
|
+
uc == 13 ||
|
259
|
+
uc == 32 ||
|
260
|
+
uc == 160 ||
|
261
|
+
uc == 5760 ||
|
262
|
+
(uc >= 8192 && uc <= 8202) ||
|
263
|
+
uc == 8239 ||
|
264
|
+
uc == 8287 ||
|
265
|
+
uc == 12288);
|
266
|
+
}
|
267
|
+
|
268
|
+
// matches anything in the P[cdefios] classes.
|
269
|
+
int utf8proc_is_punctuation(int32_t uc)
|
270
|
+
{
|
271
|
+
return ((uc < 128 && cmark_ispunct((char)uc)) ||
|
272
|
+
uc == 161 ||
|
273
|
+
uc == 167 ||
|
274
|
+
uc == 171 ||
|
275
|
+
uc == 182 ||
|
276
|
+
uc == 183 ||
|
277
|
+
uc == 187 ||
|
278
|
+
uc == 191 ||
|
279
|
+
uc == 894 ||
|
280
|
+
uc == 903 ||
|
281
|
+
(uc >= 1370 && uc <= 1375) ||
|
282
|
+
uc == 1417 ||
|
283
|
+
uc == 1418 ||
|
284
|
+
uc == 1470 ||
|
285
|
+
uc == 1472 ||
|
286
|
+
uc == 1475 ||
|
287
|
+
uc == 1478 ||
|
288
|
+
uc == 1523 ||
|
289
|
+
uc == 1524 ||
|
290
|
+
uc == 1545 ||
|
291
|
+
uc == 1546 ||
|
292
|
+
uc == 1548 ||
|
293
|
+
uc == 1549 ||
|
294
|
+
uc == 1563 ||
|
295
|
+
uc == 1566 ||
|
296
|
+
uc == 1567 ||
|
297
|
+
(uc >= 1642 && uc <= 1645) ||
|
298
|
+
uc == 1748 ||
|
299
|
+
(uc >= 1792 && uc <= 1805) ||
|
300
|
+
(uc >= 2039 && uc <= 2041) ||
|
301
|
+
(uc >= 2096 && uc <= 2110) ||
|
302
|
+
uc == 2142 ||
|
303
|
+
uc == 2404 ||
|
304
|
+
uc == 2405 ||
|
305
|
+
uc == 2416 ||
|
306
|
+
uc == 2800 ||
|
307
|
+
uc == 3572 ||
|
308
|
+
uc == 3663 ||
|
309
|
+
uc == 3674 ||
|
310
|
+
uc == 3675 ||
|
311
|
+
(uc >= 3844 && uc <= 3858) ||
|
312
|
+
uc == 3860 ||
|
313
|
+
(uc >= 3898 && uc <= 3901) ||
|
314
|
+
uc == 3973 ||
|
315
|
+
(uc >= 4048 && uc <= 4052) ||
|
316
|
+
uc == 4057 ||
|
317
|
+
uc == 4058 ||
|
318
|
+
(uc >= 4170 && uc <= 4175) ||
|
319
|
+
uc == 4347 ||
|
320
|
+
(uc >= 4960 && uc <= 4968) ||
|
321
|
+
uc == 5120 ||
|
322
|
+
uc == 5741 ||
|
323
|
+
uc == 5742 ||
|
324
|
+
uc == 5787 ||
|
325
|
+
uc == 5788 ||
|
326
|
+
(uc >= 5867 && uc <= 5869) ||
|
327
|
+
uc == 5941 ||
|
328
|
+
uc == 5942 ||
|
329
|
+
(uc >= 6100 && uc <= 6102) ||
|
330
|
+
(uc >= 6104 && uc <= 6106) ||
|
331
|
+
(uc >= 6144 && uc <= 6154) ||
|
332
|
+
uc == 6468 ||
|
333
|
+
uc == 6469 ||
|
334
|
+
uc == 6686 ||
|
335
|
+
uc == 6687 ||
|
336
|
+
(uc >= 6816 && uc <= 6822) ||
|
337
|
+
(uc >= 6824 && uc <= 6829) ||
|
338
|
+
(uc >= 7002 && uc <= 7008) ||
|
339
|
+
(uc >= 7164 && uc <= 7167) ||
|
340
|
+
(uc >= 7227 && uc <= 7231) ||
|
341
|
+
uc == 7294 ||
|
342
|
+
uc == 7295 ||
|
343
|
+
(uc >= 7360 && uc <= 7367) ||
|
344
|
+
uc == 7379 ||
|
345
|
+
(uc >= 8208 && uc <= 8231) ||
|
346
|
+
(uc >= 8240 && uc <= 8259) ||
|
347
|
+
(uc >= 8261 && uc <= 8273) ||
|
348
|
+
(uc >= 8275 && uc <= 8286) ||
|
349
|
+
uc == 8317 ||
|
350
|
+
uc == 8318 ||
|
351
|
+
uc == 8333 ||
|
352
|
+
uc == 8334 ||
|
353
|
+
(uc >= 8968 && uc <= 8971) ||
|
354
|
+
uc == 9001 ||
|
355
|
+
uc == 9002 ||
|
356
|
+
(uc >= 10088 && uc <= 10101) ||
|
357
|
+
uc == 10181 ||
|
358
|
+
uc == 10182 ||
|
359
|
+
(uc >= 10214 && uc <= 10223) ||
|
360
|
+
(uc >= 10627 && uc <= 10648) ||
|
361
|
+
(uc >= 10712 && uc <= 10715) ||
|
362
|
+
uc == 10748 ||
|
363
|
+
uc == 10749 ||
|
364
|
+
(uc >= 11513 && uc <= 11516) ||
|
365
|
+
uc == 11518 ||
|
366
|
+
uc == 11519 ||
|
367
|
+
uc == 11632 ||
|
368
|
+
(uc >= 11776 && uc <= 11822) ||
|
369
|
+
(uc >= 11824 && uc <= 11842) ||
|
370
|
+
(uc >= 12289 && uc <= 12291) ||
|
371
|
+
(uc >= 12296 && uc <= 12305) ||
|
372
|
+
(uc >= 12308 && uc <= 12319) ||
|
373
|
+
uc == 12336 ||
|
374
|
+
uc == 12349 ||
|
375
|
+
uc == 12448 ||
|
376
|
+
uc == 12539 ||
|
377
|
+
uc == 42238 ||
|
378
|
+
uc == 42239 ||
|
379
|
+
(uc >= 42509 && uc <= 42511) ||
|
380
|
+
uc == 42611 ||
|
381
|
+
uc == 42622 ||
|
382
|
+
(uc >= 42738 && uc <= 42743) ||
|
383
|
+
(uc >= 43124 && uc <= 43127) ||
|
384
|
+
uc == 43214 ||
|
385
|
+
uc == 43215 ||
|
386
|
+
(uc >= 43256 && uc <= 43258) ||
|
387
|
+
uc == 43310 ||
|
388
|
+
uc == 43311 ||
|
389
|
+
uc == 43359 ||
|
390
|
+
(uc >= 43457 && uc <= 43469) ||
|
391
|
+
uc == 43486 ||
|
392
|
+
uc == 43487 ||
|
393
|
+
(uc >= 43612 && uc <= 43615) ||
|
394
|
+
uc == 43742 ||
|
395
|
+
uc == 43743 ||
|
396
|
+
uc == 43760 ||
|
397
|
+
uc == 43761 ||
|
398
|
+
uc == 44011 ||
|
399
|
+
uc == 64830 ||
|
400
|
+
uc == 64831 ||
|
401
|
+
(uc >= 65040 && uc <= 65049) ||
|
402
|
+
(uc >= 65072 && uc <= 65106) ||
|
403
|
+
(uc >= 65108 && uc <= 65121) ||
|
404
|
+
uc == 65123 ||
|
405
|
+
uc == 65128 ||
|
406
|
+
uc == 65130 ||
|
407
|
+
uc == 65131 ||
|
408
|
+
(uc >= 65281 && uc <= 65283) ||
|
409
|
+
(uc >= 65285 && uc <= 65290) ||
|
410
|
+
(uc >= 65292 && uc <= 65295) ||
|
411
|
+
uc == 65306 ||
|
412
|
+
uc == 65307 ||
|
413
|
+
uc == 65311 ||
|
414
|
+
uc == 65312 ||
|
415
|
+
(uc >= 65339 && uc <= 65341) ||
|
416
|
+
uc == 65343 ||
|
417
|
+
uc == 65371 ||
|
418
|
+
uc == 65373 ||
|
419
|
+
(uc >= 65375 && uc <= 65381) ||
|
420
|
+
(uc >= 65792 && uc <= 65794) ||
|
421
|
+
uc == 66463 ||
|
422
|
+
uc == 66512 ||
|
423
|
+
uc == 66927 ||
|
424
|
+
uc == 67671 ||
|
425
|
+
uc == 67871 ||
|
426
|
+
uc == 67903 ||
|
427
|
+
(uc >= 68176 && uc <= 68184) ||
|
428
|
+
uc == 68223 ||
|
429
|
+
(uc >= 68336 && uc <= 68342) ||
|
430
|
+
(uc >= 68409 && uc <= 68415) ||
|
431
|
+
(uc >= 68505 && uc <= 68508) ||
|
432
|
+
(uc >= 69703 && uc <= 69709) ||
|
433
|
+
uc == 69819 ||
|
434
|
+
uc == 69820 ||
|
435
|
+
(uc >= 69822 && uc <= 69825) ||
|
436
|
+
(uc >= 69952 && uc <= 69955) ||
|
437
|
+
uc == 70004 ||
|
438
|
+
uc == 70005 ||
|
439
|
+
(uc >= 70085 && uc <= 70088) ||
|
440
|
+
uc == 70093 ||
|
441
|
+
(uc >= 70200 && uc <= 70205) ||
|
442
|
+
uc == 70854 ||
|
443
|
+
(uc >= 71105 && uc <= 71113) ||
|
444
|
+
(uc >= 71233 && uc <= 71235) ||
|
445
|
+
(uc >= 74864 && uc <= 74868) ||
|
446
|
+
uc == 92782 ||
|
447
|
+
uc == 92783 ||
|
448
|
+
uc == 92917 ||
|
449
|
+
(uc >= 92983 && uc <= 92987) ||
|
450
|
+
uc == 92996 ||
|
451
|
+
uc == 113823);
|
452
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#ifndef CMARK_UTF8_H
|
2
|
+
#define CMARK_UTF8_H
|
3
|
+
|
4
|
+
#include <stdint.h>
|
5
|
+
#include "buffer.h"
|
6
|
+
|
7
|
+
#ifdef __cplusplus
|
8
|
+
extern "C" {
|
9
|
+
#endif
|
10
|
+
|
11
|
+
void utf8proc_case_fold(cmark_strbuf *dest, const uint8_t *str, int len);
|
12
|
+
void utf8proc_encode_char(int32_t uc, cmark_strbuf *buf);
|
13
|
+
int utf8proc_iterate(const uint8_t *str, int str_len, int32_t *dst);
|
14
|
+
void utf8proc_detab(cmark_strbuf *dest, const uint8_t *line, size_t size);
|
15
|
+
int utf8proc_is_space(int32_t uc);
|
16
|
+
int utf8proc_is_punctuation(int32_t uc);
|
17
|
+
|
18
|
+
#ifdef __cplusplus
|
19
|
+
}
|
20
|
+
#endif
|
21
|
+
|
22
|
+
#endif
|
@@ -0,0 +1,170 @@
|
|
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 "houdini.h"
|
11
|
+
|
12
|
+
// Functions to convert cmark_nodes to XML strings.
|
13
|
+
|
14
|
+
static void escape_xml(cmark_strbuf *dest, const unsigned char *source, int length)
|
15
|
+
{
|
16
|
+
if (source != NULL) {
|
17
|
+
if (length < 0)
|
18
|
+
length = strlen((char *)source);
|
19
|
+
|
20
|
+
houdini_escape_html0(dest, source, (size_t)length, 0);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
struct render_state {
|
25
|
+
cmark_strbuf* xml;
|
26
|
+
int indent;
|
27
|
+
};
|
28
|
+
|
29
|
+
static inline void indent(struct render_state *state)
|
30
|
+
{
|
31
|
+
int i;
|
32
|
+
for (i = 0; i < state->indent; i++) {
|
33
|
+
cmark_strbuf_putc(state->xml, ' ');
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
static int
|
38
|
+
S_render_node(cmark_node *node, cmark_event_type ev_type,
|
39
|
+
struct render_state *state, int options)
|
40
|
+
{
|
41
|
+
cmark_strbuf *xml = state->xml;
|
42
|
+
bool literal = false;
|
43
|
+
cmark_delim_type delim;
|
44
|
+
bool entering = (ev_type == CMARK_EVENT_ENTER);
|
45
|
+
|
46
|
+
if (entering) {
|
47
|
+
indent(state);
|
48
|
+
cmark_strbuf_printf(xml, "<%s",
|
49
|
+
cmark_node_get_type_string(node));
|
50
|
+
|
51
|
+
if (options & CMARK_OPT_SOURCEPOS && node->start_line != 0) {
|
52
|
+
cmark_strbuf_printf(xml, " sourcepos=\"%d:%d-%d:%d\"",
|
53
|
+
node->start_line,
|
54
|
+
node->start_column,
|
55
|
+
node->end_line,
|
56
|
+
node->end_column);
|
57
|
+
}
|
58
|
+
|
59
|
+
literal = false;
|
60
|
+
|
61
|
+
switch (node->type) {
|
62
|
+
case CMARK_NODE_TEXT:
|
63
|
+
case CMARK_NODE_CODE:
|
64
|
+
case CMARK_NODE_HTML:
|
65
|
+
case CMARK_NODE_INLINE_HTML:
|
66
|
+
cmark_strbuf_puts(xml, ">");
|
67
|
+
escape_xml(xml, node->as.literal.data,
|
68
|
+
node->as.literal.len);
|
69
|
+
cmark_strbuf_puts(xml, "</");
|
70
|
+
cmark_strbuf_puts(xml,
|
71
|
+
cmark_node_get_type_string(node));
|
72
|
+
literal = true;
|
73
|
+
break;
|
74
|
+
case CMARK_NODE_LIST:
|
75
|
+
switch (cmark_node_get_list_type(node)) {
|
76
|
+
case CMARK_ORDERED_LIST:
|
77
|
+
cmark_strbuf_puts(xml, " type=\"ordered\"");
|
78
|
+
cmark_strbuf_printf(xml, " start=\"%d\"",
|
79
|
+
cmark_node_get_list_start(node));
|
80
|
+
delim = cmark_node_get_list_delim(node);
|
81
|
+
if (delim == CMARK_PAREN_DELIM) {
|
82
|
+
cmark_strbuf_puts(xml,
|
83
|
+
" delim=\"paren\"");
|
84
|
+
} else if (delim == CMARK_PERIOD_DELIM) {
|
85
|
+
cmark_strbuf_puts(xml,
|
86
|
+
" delim=\"period\"");
|
87
|
+
}
|
88
|
+
break;
|
89
|
+
case CMARK_BULLET_LIST:
|
90
|
+
cmark_strbuf_puts(xml, " type=\"bullet\"");
|
91
|
+
break;
|
92
|
+
default:
|
93
|
+
break;
|
94
|
+
}
|
95
|
+
cmark_strbuf_printf(xml, " tight=\"%s\"",
|
96
|
+
(cmark_node_get_list_tight(node) ?
|
97
|
+
"true" : "false"));
|
98
|
+
break;
|
99
|
+
case CMARK_NODE_HEADER:
|
100
|
+
cmark_strbuf_printf(xml, " level=\"%d\"",
|
101
|
+
node->as.header.level);
|
102
|
+
break;
|
103
|
+
case CMARK_NODE_CODE_BLOCK:
|
104
|
+
if (node->as.code.info.len > 0) {
|
105
|
+
cmark_strbuf_puts(xml, " info=\"");
|
106
|
+
escape_xml(xml, node->as.code.info.data,
|
107
|
+
node->as.code.info.len);
|
108
|
+
cmark_strbuf_putc(xml, '"');
|
109
|
+
}
|
110
|
+
cmark_strbuf_puts(xml, ">");
|
111
|
+
escape_xml(xml, node->as.code.literal.data,
|
112
|
+
node->as.code.literal.len);
|
113
|
+
cmark_strbuf_puts(xml, "</");
|
114
|
+
cmark_strbuf_puts(xml,
|
115
|
+
cmark_node_get_type_string(node));
|
116
|
+
literal = true;
|
117
|
+
break;
|
118
|
+
case CMARK_NODE_LINK:
|
119
|
+
case CMARK_NODE_IMAGE:
|
120
|
+
cmark_strbuf_puts(xml, " destination=\"");
|
121
|
+
escape_xml(xml, node->as.link.url, -1);
|
122
|
+
cmark_strbuf_putc(xml, '"');
|
123
|
+
cmark_strbuf_puts(xml, " title=\"");
|
124
|
+
escape_xml(xml, node->as.link.title, -1);
|
125
|
+
cmark_strbuf_putc(xml, '"');
|
126
|
+
break;
|
127
|
+
default:
|
128
|
+
break;
|
129
|
+
}
|
130
|
+
if (node->first_child) {
|
131
|
+
state->indent += 2;
|
132
|
+
} else if (!literal) {
|
133
|
+
cmark_strbuf_puts(xml, " /");
|
134
|
+
}
|
135
|
+
cmark_strbuf_puts(xml, ">\n");
|
136
|
+
|
137
|
+
|
138
|
+
} else if (node->first_child) {
|
139
|
+
state->indent -= 2;
|
140
|
+
indent(state);
|
141
|
+
cmark_strbuf_printf(xml, "</%s>\n",
|
142
|
+
cmark_node_get_type_string(node));
|
143
|
+
}
|
144
|
+
|
145
|
+
return 1;
|
146
|
+
}
|
147
|
+
|
148
|
+
char *cmark_render_xml(cmark_node *root, int options)
|
149
|
+
{
|
150
|
+
char *result;
|
151
|
+
cmark_strbuf xml = GH_BUF_INIT;
|
152
|
+
cmark_event_type ev_type;
|
153
|
+
cmark_node *cur;
|
154
|
+
struct render_state state = { &xml, 0 };
|
155
|
+
|
156
|
+
cmark_iter *iter = cmark_iter_new(root);
|
157
|
+
|
158
|
+
cmark_strbuf_puts(state.xml,
|
159
|
+
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
160
|
+
cmark_strbuf_puts(state.xml,
|
161
|
+
"<!DOCTYPE CommonMark SYSTEM \"CommonMark.dtd\">\n");
|
162
|
+
while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) {
|
163
|
+
cur = cmark_iter_get_node(iter);
|
164
|
+
S_render_node(cur, ev_type, &state, options);
|
165
|
+
}
|
166
|
+
result = (char *)cmark_strbuf_detach(&xml);
|
167
|
+
|
168
|
+
cmark_iter_free(iter);
|
169
|
+
return result;
|
170
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# To get verbose output: cmake --build build --target "test" -- ARGS='-V'
|
2
|
+
|
3
|
+
# By default, we run the spec tests only if python3 is available.
|
4
|
+
# To require the spec tests, compile with -DSPEC_TESTS=1
|
5
|
+
|
6
|
+
if (SPEC_TESTS)
|
7
|
+
find_package(PythonInterp 3 REQUIRED)
|
8
|
+
else(SPEC_TESTS)
|
9
|
+
find_package(PythonInterp 3)
|
10
|
+
endif(SPEC_TESTS)
|
11
|
+
|
12
|
+
add_test(NAME api_test COMMAND api_test)
|
13
|
+
|
14
|
+
if (WIN32)
|
15
|
+
file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR}/src WIN_DLL_DIR)
|
16
|
+
set_tests_properties(api_test PROPERTIES
|
17
|
+
ENVIRONMENT "PATH=${WIN_DLL_DIR};$ENV{PATH}"
|
18
|
+
)
|
19
|
+
endif(WIN32)
|
20
|
+
|
21
|
+
IF (PYTHONINTERP_FOUND)
|
22
|
+
|
23
|
+
add_test(html_normalization
|
24
|
+
${PYTHON_EXECUTABLE} "-m" "doctest"
|
25
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/normalize.py"
|
26
|
+
)
|
27
|
+
|
28
|
+
add_test(spectest_library
|
29
|
+
${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/spec_tests.py" "--no-normalize" "--spec"
|
30
|
+
"${CMAKE_SOURCE_DIR}/test/spec.txt" "--library-dir" "${CMAKE_BINARY_DIR}/src"
|
31
|
+
)
|
32
|
+
|
33
|
+
add_test(pathological_tests_library
|
34
|
+
${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/pathological_tests.py"
|
35
|
+
"--library-dir" "${CMAKE_BINARY_DIR}/src"
|
36
|
+
)
|
37
|
+
|
38
|
+
add_test(spectest_executable
|
39
|
+
${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/spec_tests.py" "--no-normalize" "--spec" "${CMAKE_SOURCE_DIR}/test/spec.txt" "--program" "${CMAKE_BINARY_DIR}/src/cmark"
|
40
|
+
)
|
41
|
+
|
42
|
+
add_test(smartpuncttest_executable
|
43
|
+
${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/spec_tests.py" "--no-normalize" "--spec" "${CMAKE_SOURCE_DIR}/test/smart_punct.txt" "--program" "${CMAKE_BINARY_DIR}/src/cmark --smart"
|
44
|
+
)
|
45
|
+
|
46
|
+
ELSE(PYTHONINTERP_FOUND)
|
47
|
+
|
48
|
+
message("\n*** A python 3 interpreter is required to run the spec tests.\n")
|
49
|
+
add_test(skipping_spectests
|
50
|
+
echo "Skipping spec tests, because no python 3 interpreter is available.")
|
51
|
+
|
52
|
+
ENDIF(PYTHONINTERP_FOUND)
|
53
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
*
|
@@ -0,0 +1 @@
|
|
1
|
+
a="1"
|
@@ -0,0 +1 @@
|
|
1
|
+
href="1"
|
@@ -0,0 +1 @@
|
|
1
|
+
xml:lang="1"
|
@@ -0,0 +1 @@
|
|
1
|
+
xmlns="1"
|
@@ -0,0 +1 @@
|
|
1
|
+
\
|