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.
- checksums.yaml +4 -4
- data/Rakefile +0 -7
- data/ext/commonmarker/{cmark/src/arena.c → arena.c} +0 -0
- data/ext/commonmarker/{cmark/extensions/autolink.c → autolink.c} +0 -0
- data/ext/commonmarker/{cmark/extensions/autolink.h → autolink.h} +0 -0
- data/ext/commonmarker/{cmark/src/blocks.c → blocks.c} +0 -0
- data/ext/commonmarker/{cmark/src/buffer.c → buffer.c} +0 -0
- data/ext/commonmarker/{cmark/src/buffer.h → buffer.h} +0 -0
- data/ext/commonmarker/{cmark/src/case_fold_switch.inc → case_fold_switch.inc} +0 -0
- data/ext/commonmarker/{cmark/src/chunk.h → chunk.h} +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/CMakeLists.txt +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/COPYING +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/FindAsan.cmake +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/Makefile +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/Makefile.nmake +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/README.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/api_test/CMakeLists.txt +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/api_test/cplusplus.cpp +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/api_test/cplusplus.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/api_test/harness.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/api_test/harness.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/api_test/main.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/appveyor.yml +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-bq-flat.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-bq-nested.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-code.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-fences.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-heading.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-hr.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-html.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-lheading.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-list-flat.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-list-nested.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-ref-flat.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-ref-nested.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-autolink.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-backticks.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-em-flat.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-em-nested.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-em-worst.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-entity.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-escape.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-html.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-links-flat.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-links-nested.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-newlines.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/lorem1.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/rawtabs.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/statistics.py +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/bench/stats.py +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/benchmarks.md +0 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeCache.txt +478 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CMakeCCompiler.cmake +71 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CMakeCXXCompiler.cmake +73 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CMakeDetermineCompilerABI_C.bin +0 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CMakeDetermineCompilerABI_CXX.bin +0 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CMakeSystem.cmake +15 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CompilerIdC/CMakeCCompilerId.c +567 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CompilerIdC/a.out +0 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CompilerIdCXX/CMakeCXXCompilerId.cpp +539 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CompilerIdCXX/a.out +0 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/CMakeError.log +18 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/CMakeOutput.log +709 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/Makefile.cmake +157 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/Makefile2 +391 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/TargetDirectories.txt +48 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/cmake.check_cache +1 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/feature_tests.bin +0 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/feature_tests.c +34 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/feature_tests.cxx +405 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark-upstream/build/CTestTestfile.cmake +11 -0
- data/ext/commonmarker/cmark-upstream/build/Makefile +280 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/C.includecache +134 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/CXX.includecache +38 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/DependInfo.cmake +38 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/build.make +169 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/cmake_clean.cmake +12 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/cplusplus.cpp.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/depend.internal +28 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/depend.make +28 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/flags.make +17 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/harness.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/link.txt +1 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/main.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/progress.make +5 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/Makefile +302 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/api_test +0 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/cmake_install.cmake +29 -0
- data/ext/commonmarker/cmark-upstream/build/cmake_install.cmake +49 -0
- data/ext/commonmarker/cmark-upstream/build/compile_commands.json +352 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/Export/lib/cmake-gfmextensions/cmark-gfmextensions-release.cmake +30 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/Export/lib/cmake-gfmextensions/cmark-gfmextensions.cmake +108 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/C.includecache +246 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/DependInfo.cmake +36 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/autolink.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/build.make +253 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/cmake_clean.cmake +16 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/core-extensions.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/depend.internal +96 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/depend.make +96 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/ext_scanners.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/flags.make +10 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/link.txt +1 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/progress.make +8 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/strikethrough.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/table.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/tagfilter.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/C.includecache +246 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/DependInfo.cmake +29 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/autolink.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/build.make +249 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/cmake_clean.cmake +15 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/cmake_clean_target.cmake +3 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/core-extensions.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/depend.internal +96 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/depend.make +96 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/ext_scanners.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/flags.make +10 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/link.txt +2 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/progress.make +8 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/strikethrough.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/table.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/tagfilter.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/Makefile +426 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/cmake_install.cmake +84 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/cmarkextensions_export.h +42 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/libcmark-gfmextensions.0.28.3.gfm.11.dylib +0 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/libcmark-gfmextensions.a +0 -0
- data/ext/commonmarker/cmark-upstream/build/extensions/libcmark-gfmextensions.dylib +1 -0
- data/ext/commonmarker/cmark-upstream/build/man/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark-upstream/build/man/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark-upstream/build/man/Makefile +196 -0
- data/ext/commonmarker/cmark-upstream/build/man/cmake_install.cmake +37 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/Export/lib/cmake/cmark-gfm-release.cmake +38 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/Export/lib/cmake/cmark-gfm.cmake +95 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/C.includecache +156 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/DependInfo.cmake +30 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/build.make +115 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/cmake_clean.cmake +10 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/depend.internal +20 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/depend.make +20 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/flags.make +10 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/link.txt +1 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/main.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/progress.make +3 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/C.includecache +612 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/DependInfo.cmake +60 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/arena.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/blocks.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/buffer.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/build.make +819 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/cmake_clean.cmake +37 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/cmark.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/cmark_ctype.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/commonmark.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/depend.internal +319 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/depend.make +319 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/flags.make +10 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/footnotes.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/houdini_href_e.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/houdini_html_e.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/houdini_html_u.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/html.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/inlines.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/iterator.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/latex.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/link.txt +1 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/linked_list.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/man.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/map.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/node.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/plaintext.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/plugin.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/progress.make +29 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/references.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/registry.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/render.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/scanners.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/syntax_extension.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/utf8.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/xml.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/C.includecache +612 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/DependInfo.cmake +54 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/arena.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/blocks.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/buffer.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/build.make +816 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/cmake_clean.cmake +36 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/cmake_clean_target.cmake +3 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/cmark.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/cmark_ctype.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/commonmark.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/depend.internal +319 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/depend.make +319 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/flags.make +10 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/footnotes.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_href_e.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_html_e.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_html_u.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/html.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/inlines.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/iterator.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/latex.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/link.txt +2 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/linked_list.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/man.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/map.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/node.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/plaintext.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/plugin.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/progress.make +29 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/references.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/registry.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/render.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/scanners.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/syntax_extension.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/utf8.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/xml.c.o +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark-upstream/build/src/Makefile +1165 -0
- data/ext/commonmarker/cmark-upstream/build/src/cmake_install.cmake +97 -0
- data/ext/commonmarker/cmark-upstream/build/src/cmark-gfm +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/cmark_export.h +42 -0
- data/ext/commonmarker/cmark-upstream/build/src/cmark_version.h +8 -0
- data/ext/commonmarker/cmark-upstream/build/src/config.h +76 -0
- data/ext/commonmarker/cmark-upstream/build/src/libcmark-gfm.0.28.3.gfm.11.dylib +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/libcmark-gfm.a +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/libcmark-gfm.dylib +1 -0
- data/ext/commonmarker/cmark-upstream/build/src/libcmark-gfm.pc +10 -0
- data/ext/commonmarker/cmark-upstream/build/testdir/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark-upstream/build/testdir/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark-upstream/build/testdir/CTestTestfile.cmake +17 -0
- data/ext/commonmarker/cmark-upstream/build/testdir/Makefile +196 -0
- data/ext/commonmarker/cmark-upstream/build/testdir/cmake_install.cmake +29 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/changelog.txt +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/data/CaseFolding.txt +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/extensions/CMakeLists.txt +0 -0
- data/ext/commonmarker/cmark-upstream/extensions/autolink.c +421 -0
- data/ext/commonmarker/cmark-upstream/extensions/autolink.h +8 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/extensions/core-extensions.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/extensions/core-extensions.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/extensions/ext_scanners.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/extensions/ext_scanners.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/extensions/ext_scanners.re +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/extensions/strikethrough.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/extensions/strikethrough.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/extensions/table.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/extensions/table.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/extensions/tagfilter.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/extensions/tagfilter.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/man/CMakeLists.txt +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/man/make_man_page.py +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/man/man1/cmark-gfm.1 +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/man/man3/cmark-gfm.3 +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/nmake.bat +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/CMakeLists.txt +0 -0
- data/ext/commonmarker/cmark-upstream/src/arena.c +103 -0
- data/ext/commonmarker/cmark-upstream/src/blocks.c +1519 -0
- data/ext/commonmarker/cmark-upstream/src/buffer.c +279 -0
- data/ext/commonmarker/cmark-upstream/src/buffer.h +116 -0
- data/ext/commonmarker/cmark-upstream/src/case_fold_switch.inc +4327 -0
- data/ext/commonmarker/cmark-upstream/src/chunk.h +136 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark_ctype.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark_ctype.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark_extension_api.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark_version.h.in +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/commonmark.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/config.h.in +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/entities.inc +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/footnotes.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/footnotes.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/houdini.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/houdini_href_e.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/houdini_html_e.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/houdini_html_u.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/html.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/html.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/inlines.c +8 -4
- data/ext/commonmarker/{cmark → cmark-upstream}/src/inlines.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/iterator.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/iterator.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/latex.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/libcmark-gfm.pc.in +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/linked_list.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/main.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/man.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/map.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/map.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/node.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/node.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/parser.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/plaintext.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/plugin.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/plugin.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/references.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/references.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/registry.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/registry.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/render.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/render.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/scanners.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/scanners.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/scanners.re +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/syntax_extension.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/syntax_extension.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/utf8.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/utf8.h +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/src/xml.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/suppressions +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/test/CMakeLists.txt +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/test/afl_test_cases/test.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/test/cmark-fuzz.c +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/test/cmark.py +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/test/entity_tests.py +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/test/extensions.txt +2 -2
- data/ext/commonmarker/{cmark → cmark-upstream}/test/fuzzing_dictionary +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/test/normalize.py +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/test/pathological_tests.py +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/test/regression.txt +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/test/roundtrip_tests.py +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/test/run-cmark-fuzz +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/test/smart_punct.txt +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/test/spec.txt +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/test/spec_tests.py +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/toolchain-mingw32.cmake +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/tools/Dockerfile +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/tools/appveyor-build.bat +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/tools/make_entities_inc.py +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/tools/mkcasefold.pl +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/why-cmark-and-not-x.md +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/wrappers/wrapper.js +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/wrappers/wrapper.py +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/wrappers/wrapper.rb +0 -0
- data/ext/commonmarker/{cmark → cmark-upstream}/wrappers/wrapper.rkt +0 -0
- data/ext/commonmarker/cmark.c +55 -0
- data/ext/commonmarker/cmark.h +789 -0
- data/ext/commonmarker/cmark_ctype.c +44 -0
- data/ext/commonmarker/cmark_ctype.h +33 -0
- data/ext/commonmarker/cmark_export.h +42 -0
- data/ext/commonmarker/cmark_extension_api.h +719 -0
- data/ext/commonmarker/cmark_version.h +8 -0
- data/ext/commonmarker/cmarkextensions_export.h +42 -0
- data/ext/commonmarker/commonmark.c +508 -0
- data/ext/commonmarker/config.h +76 -0
- data/ext/commonmarker/core-extensions.c +25 -0
- data/ext/commonmarker/core-extensions.h +25 -0
- data/ext/commonmarker/entities.inc +2138 -0
- data/ext/commonmarker/ext_scanners.c +941 -0
- data/ext/commonmarker/ext_scanners.h +22 -0
- data/ext/commonmarker/extconf.rb +1 -48
- data/ext/commonmarker/footnotes.c +40 -0
- data/ext/commonmarker/footnotes.h +25 -0
- data/ext/commonmarker/houdini.h +57 -0
- data/ext/commonmarker/houdini_href_e.c +100 -0
- data/ext/commonmarker/houdini_html_e.c +66 -0
- data/ext/commonmarker/houdini_html_u.c +149 -0
- data/ext/commonmarker/html.c +457 -0
- data/ext/commonmarker/html.h +27 -0
- data/ext/commonmarker/inlines.c +1594 -0
- data/ext/commonmarker/inlines.h +29 -0
- data/ext/commonmarker/iterator.c +159 -0
- data/ext/commonmarker/iterator.h +27 -0
- data/ext/commonmarker/latex.c +466 -0
- data/ext/commonmarker/linked_list.c +37 -0
- data/ext/commonmarker/man.c +278 -0
- data/ext/commonmarker/map.c +122 -0
- data/ext/commonmarker/map.h +42 -0
- data/ext/commonmarker/node.c +965 -0
- data/ext/commonmarker/node.h +116 -0
- data/ext/commonmarker/parser.h +57 -0
- data/ext/commonmarker/plaintext.c +213 -0
- data/ext/commonmarker/plugin.c +36 -0
- data/ext/commonmarker/plugin.h +34 -0
- data/ext/commonmarker/references.c +42 -0
- data/ext/commonmarker/references.h +26 -0
- data/ext/commonmarker/registry.c +63 -0
- data/ext/commonmarker/registry.h +24 -0
- data/ext/commonmarker/render.c +202 -0
- data/ext/commonmarker/render.h +63 -0
- data/ext/commonmarker/scanners.c +18195 -0
- data/ext/commonmarker/scanners.h +64 -0
- data/ext/commonmarker/scanners.re +341 -0
- data/ext/commonmarker/strikethrough.c +157 -0
- data/ext/commonmarker/strikethrough.h +9 -0
- data/ext/commonmarker/syntax_extension.c +139 -0
- data/ext/commonmarker/syntax_extension.h +32 -0
- data/ext/commonmarker/table.c +683 -0
- data/ext/commonmarker/table.h +8 -0
- data/ext/commonmarker/tagfilter.c +60 -0
- data/ext/commonmarker/tagfilter.h +8 -0
- data/ext/commonmarker/utf8.c +317 -0
- data/ext/commonmarker/utf8.h +35 -0
- data/ext/commonmarker/xml.c +174 -0
- data/lib/commonmarker/version.rb +1 -1
- data/test/test_helper.rb +1 -1
- metadata +401 -145
@@ -0,0 +1,60 @@
|
|
1
|
+
#include "tagfilter.h"
|
2
|
+
#include <parser.h>
|
3
|
+
#include <ctype.h>
|
4
|
+
|
5
|
+
static const char *blacklist[] = {
|
6
|
+
"title", "textarea", "style", "xmp", "iframe",
|
7
|
+
"noembed", "noframes", "script", "plaintext", NULL,
|
8
|
+
};
|
9
|
+
|
10
|
+
static int is_tag(const unsigned char *tag_data, size_t tag_size,
|
11
|
+
const char *tagname) {
|
12
|
+
size_t i;
|
13
|
+
|
14
|
+
if (tag_size < 3 || tag_data[0] != '<')
|
15
|
+
return 0;
|
16
|
+
|
17
|
+
i = 1;
|
18
|
+
|
19
|
+
if (tag_data[i] == '/') {
|
20
|
+
i++;
|
21
|
+
}
|
22
|
+
|
23
|
+
for (; i < tag_size; ++i, ++tagname) {
|
24
|
+
if (*tagname == 0)
|
25
|
+
break;
|
26
|
+
|
27
|
+
if (tolower(tag_data[i]) != *tagname)
|
28
|
+
return 0;
|
29
|
+
}
|
30
|
+
|
31
|
+
if (i == tag_size)
|
32
|
+
return 0;
|
33
|
+
|
34
|
+
if (cmark_isspace(tag_data[i]) || tag_data[i] == '>')
|
35
|
+
return 1;
|
36
|
+
|
37
|
+
if (tag_data[i] == '/' && tag_size >= i + 2 && tag_data[i + 1] == '>')
|
38
|
+
return 1;
|
39
|
+
|
40
|
+
return 0;
|
41
|
+
}
|
42
|
+
|
43
|
+
static int filter(cmark_syntax_extension *ext, const unsigned char *tag,
|
44
|
+
size_t tag_len) {
|
45
|
+
const char **it;
|
46
|
+
|
47
|
+
for (it = blacklist; *it; ++it) {
|
48
|
+
if (is_tag(tag, tag_len, *it)) {
|
49
|
+
return 0;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
return 1;
|
54
|
+
}
|
55
|
+
|
56
|
+
cmark_syntax_extension *create_tagfilter_extension(void) {
|
57
|
+
cmark_syntax_extension *ext = cmark_syntax_extension_new("tagfilter");
|
58
|
+
cmark_syntax_extension_set_html_filter_func(ext, filter);
|
59
|
+
return ext;
|
60
|
+
}
|
@@ -0,0 +1,317 @@
|
|
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, 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, 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, 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, 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, 1, 1, 1, 1, 1, 1, 1, 1,
|
14
|
+
1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
15
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
16
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
17
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
18
|
+
2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
19
|
+
4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0};
|
20
|
+
|
21
|
+
static void encode_unknown(cmark_strbuf *buf) {
|
22
|
+
static const uint8_t repl[] = {239, 191, 189};
|
23
|
+
cmark_strbuf_put(buf, repl, 3);
|
24
|
+
}
|
25
|
+
|
26
|
+
static int utf8proc_charlen(const uint8_t *str, bufsize_t str_len) {
|
27
|
+
int length, i;
|
28
|
+
|
29
|
+
if (!str_len)
|
30
|
+
return 0;
|
31
|
+
|
32
|
+
length = utf8proc_utf8class[str[0]];
|
33
|
+
|
34
|
+
if (!length)
|
35
|
+
return -1;
|
36
|
+
|
37
|
+
if (str_len >= 0 && (bufsize_t)length > str_len)
|
38
|
+
return -str_len;
|
39
|
+
|
40
|
+
for (i = 1; i < length; i++) {
|
41
|
+
if ((str[i] & 0xC0) != 0x80)
|
42
|
+
return -i;
|
43
|
+
}
|
44
|
+
|
45
|
+
return length;
|
46
|
+
}
|
47
|
+
|
48
|
+
// Validate a single UTF-8 character according to RFC 3629.
|
49
|
+
static int utf8proc_valid(const uint8_t *str, bufsize_t str_len) {
|
50
|
+
int length = utf8proc_utf8class[str[0]];
|
51
|
+
|
52
|
+
if (!length)
|
53
|
+
return -1;
|
54
|
+
|
55
|
+
if ((bufsize_t)length > str_len)
|
56
|
+
return -str_len;
|
57
|
+
|
58
|
+
switch (length) {
|
59
|
+
case 2:
|
60
|
+
if ((str[1] & 0xC0) != 0x80)
|
61
|
+
return -1;
|
62
|
+
if (str[0] < 0xC2) {
|
63
|
+
// Overlong
|
64
|
+
return -length;
|
65
|
+
}
|
66
|
+
break;
|
67
|
+
|
68
|
+
case 3:
|
69
|
+
if ((str[1] & 0xC0) != 0x80)
|
70
|
+
return -1;
|
71
|
+
if ((str[2] & 0xC0) != 0x80)
|
72
|
+
return -2;
|
73
|
+
if (str[0] == 0xE0) {
|
74
|
+
if (str[1] < 0xA0) {
|
75
|
+
// Overlong
|
76
|
+
return -length;
|
77
|
+
}
|
78
|
+
} else if (str[0] == 0xED) {
|
79
|
+
if (str[1] >= 0xA0) {
|
80
|
+
// Surrogate
|
81
|
+
return -length;
|
82
|
+
}
|
83
|
+
}
|
84
|
+
break;
|
85
|
+
|
86
|
+
case 4:
|
87
|
+
if ((str[1] & 0xC0) != 0x80)
|
88
|
+
return -1;
|
89
|
+
if ((str[2] & 0xC0) != 0x80)
|
90
|
+
return -2;
|
91
|
+
if ((str[3] & 0xC0) != 0x80)
|
92
|
+
return -3;
|
93
|
+
if (str[0] == 0xF0) {
|
94
|
+
if (str[1] < 0x90) {
|
95
|
+
// Overlong
|
96
|
+
return -length;
|
97
|
+
}
|
98
|
+
} else if (str[0] >= 0xF4) {
|
99
|
+
if (str[0] > 0xF4 || str[1] >= 0x90) {
|
100
|
+
// Above 0x10FFFF
|
101
|
+
return -length;
|
102
|
+
}
|
103
|
+
}
|
104
|
+
break;
|
105
|
+
}
|
106
|
+
|
107
|
+
return length;
|
108
|
+
}
|
109
|
+
|
110
|
+
void cmark_utf8proc_check(cmark_strbuf *ob, const uint8_t *line,
|
111
|
+
bufsize_t size) {
|
112
|
+
bufsize_t i = 0;
|
113
|
+
|
114
|
+
while (i < size) {
|
115
|
+
bufsize_t org = i;
|
116
|
+
int charlen = 0;
|
117
|
+
|
118
|
+
while (i < size) {
|
119
|
+
if (line[i] < 0x80 && line[i] != 0) {
|
120
|
+
i++;
|
121
|
+
} else if (line[i] >= 0x80) {
|
122
|
+
charlen = utf8proc_valid(line + i, size - i);
|
123
|
+
if (charlen < 0) {
|
124
|
+
charlen = -charlen;
|
125
|
+
break;
|
126
|
+
}
|
127
|
+
i += charlen;
|
128
|
+
} else if (line[i] == 0) {
|
129
|
+
// ASCII NUL is technically valid but rejected
|
130
|
+
// for security reasons.
|
131
|
+
charlen = 1;
|
132
|
+
break;
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
if (i > org) {
|
137
|
+
cmark_strbuf_put(ob, line + org, i - org);
|
138
|
+
}
|
139
|
+
|
140
|
+
if (i >= size) {
|
141
|
+
break;
|
142
|
+
} else {
|
143
|
+
// Invalid UTF-8
|
144
|
+
encode_unknown(ob);
|
145
|
+
i += charlen;
|
146
|
+
}
|
147
|
+
}
|
148
|
+
}
|
149
|
+
|
150
|
+
int cmark_utf8proc_iterate(const uint8_t *str, bufsize_t str_len,
|
151
|
+
int32_t *dst) {
|
152
|
+
int length;
|
153
|
+
int32_t uc = -1;
|
154
|
+
|
155
|
+
*dst = -1;
|
156
|
+
length = utf8proc_charlen(str, str_len);
|
157
|
+
if (length < 0)
|
158
|
+
return -1;
|
159
|
+
|
160
|
+
switch (length) {
|
161
|
+
case 1:
|
162
|
+
uc = str[0];
|
163
|
+
break;
|
164
|
+
case 2:
|
165
|
+
uc = ((str[0] & 0x1F) << 6) + (str[1] & 0x3F);
|
166
|
+
if (uc < 0x80)
|
167
|
+
uc = -1;
|
168
|
+
break;
|
169
|
+
case 3:
|
170
|
+
uc = ((str[0] & 0x0F) << 12) + ((str[1] & 0x3F) << 6) + (str[2] & 0x3F);
|
171
|
+
if (uc < 0x800 || (uc >= 0xD800 && uc < 0xE000))
|
172
|
+
uc = -1;
|
173
|
+
break;
|
174
|
+
case 4:
|
175
|
+
uc = ((str[0] & 0x07) << 18) + ((str[1] & 0x3F) << 12) +
|
176
|
+
((str[2] & 0x3F) << 6) + (str[3] & 0x3F);
|
177
|
+
if (uc < 0x10000 || uc >= 0x110000)
|
178
|
+
uc = -1;
|
179
|
+
break;
|
180
|
+
}
|
181
|
+
|
182
|
+
if (uc < 0)
|
183
|
+
return -1;
|
184
|
+
|
185
|
+
*dst = uc;
|
186
|
+
return length;
|
187
|
+
}
|
188
|
+
|
189
|
+
void cmark_utf8proc_encode_char(int32_t uc, cmark_strbuf *buf) {
|
190
|
+
uint8_t dst[4];
|
191
|
+
bufsize_t len = 0;
|
192
|
+
|
193
|
+
assert(uc >= 0);
|
194
|
+
|
195
|
+
if (uc < 0x80) {
|
196
|
+
dst[0] = (uint8_t)(uc);
|
197
|
+
len = 1;
|
198
|
+
} else if (uc < 0x800) {
|
199
|
+
dst[0] = (uint8_t)(0xC0 + (uc >> 6));
|
200
|
+
dst[1] = 0x80 + (uc & 0x3F);
|
201
|
+
len = 2;
|
202
|
+
} else if (uc == 0xFFFF) {
|
203
|
+
dst[0] = 0xFF;
|
204
|
+
len = 1;
|
205
|
+
} else if (uc == 0xFFFE) {
|
206
|
+
dst[0] = 0xFE;
|
207
|
+
len = 1;
|
208
|
+
} else if (uc < 0x10000) {
|
209
|
+
dst[0] = (uint8_t)(0xE0 + (uc >> 12));
|
210
|
+
dst[1] = 0x80 + ((uc >> 6) & 0x3F);
|
211
|
+
dst[2] = 0x80 + (uc & 0x3F);
|
212
|
+
len = 3;
|
213
|
+
} else if (uc < 0x110000) {
|
214
|
+
dst[0] = (uint8_t)(0xF0 + (uc >> 18));
|
215
|
+
dst[1] = 0x80 + ((uc >> 12) & 0x3F);
|
216
|
+
dst[2] = 0x80 + ((uc >> 6) & 0x3F);
|
217
|
+
dst[3] = 0x80 + (uc & 0x3F);
|
218
|
+
len = 4;
|
219
|
+
} else {
|
220
|
+
encode_unknown(buf);
|
221
|
+
return;
|
222
|
+
}
|
223
|
+
|
224
|
+
cmark_strbuf_put(buf, dst, len);
|
225
|
+
}
|
226
|
+
|
227
|
+
void cmark_utf8proc_case_fold(cmark_strbuf *dest, const uint8_t *str,
|
228
|
+
bufsize_t len) {
|
229
|
+
int32_t c;
|
230
|
+
|
231
|
+
#define bufpush(x) cmark_utf8proc_encode_char(x, dest)
|
232
|
+
|
233
|
+
while (len > 0) {
|
234
|
+
bufsize_t char_len = cmark_utf8proc_iterate(str, len, &c);
|
235
|
+
|
236
|
+
if (char_len >= 0) {
|
237
|
+
#include "case_fold_switch.inc"
|
238
|
+
} else {
|
239
|
+
encode_unknown(dest);
|
240
|
+
char_len = -char_len;
|
241
|
+
}
|
242
|
+
|
243
|
+
str += char_len;
|
244
|
+
len -= char_len;
|
245
|
+
}
|
246
|
+
}
|
247
|
+
|
248
|
+
// matches anything in the Zs class, plus LF, CR, TAB, FF.
|
249
|
+
int cmark_utf8proc_is_space(int32_t uc) {
|
250
|
+
return (uc == 9 || uc == 10 || uc == 12 || uc == 13 || uc == 32 ||
|
251
|
+
uc == 160 || uc == 5760 || (uc >= 8192 && uc <= 8202) || uc == 8239 ||
|
252
|
+
uc == 8287 || uc == 12288);
|
253
|
+
}
|
254
|
+
|
255
|
+
// matches anything in the P[cdefios] classes.
|
256
|
+
int cmark_utf8proc_is_punctuation(int32_t uc) {
|
257
|
+
return (
|
258
|
+
(uc < 128 && cmark_ispunct((char)uc)) || uc == 161 || uc == 167 ||
|
259
|
+
uc == 171 || uc == 182 || uc == 183 || uc == 187 || uc == 191 ||
|
260
|
+
uc == 894 || uc == 903 || (uc >= 1370 && uc <= 1375) || uc == 1417 ||
|
261
|
+
uc == 1418 || uc == 1470 || uc == 1472 || uc == 1475 || uc == 1478 ||
|
262
|
+
uc == 1523 || uc == 1524 || uc == 1545 || uc == 1546 || uc == 1548 ||
|
263
|
+
uc == 1549 || uc == 1563 || uc == 1566 || uc == 1567 ||
|
264
|
+
(uc >= 1642 && uc <= 1645) || uc == 1748 || (uc >= 1792 && uc <= 1805) ||
|
265
|
+
(uc >= 2039 && uc <= 2041) || (uc >= 2096 && uc <= 2110) || uc == 2142 ||
|
266
|
+
uc == 2404 || uc == 2405 || uc == 2416 || uc == 2800 || uc == 3572 ||
|
267
|
+
uc == 3663 || uc == 3674 || uc == 3675 || (uc >= 3844 && uc <= 3858) ||
|
268
|
+
uc == 3860 || (uc >= 3898 && uc <= 3901) || uc == 3973 ||
|
269
|
+
(uc >= 4048 && uc <= 4052) || uc == 4057 || uc == 4058 ||
|
270
|
+
(uc >= 4170 && uc <= 4175) || uc == 4347 || (uc >= 4960 && uc <= 4968) ||
|
271
|
+
uc == 5120 || uc == 5741 || uc == 5742 || uc == 5787 || uc == 5788 ||
|
272
|
+
(uc >= 5867 && uc <= 5869) || uc == 5941 || uc == 5942 ||
|
273
|
+
(uc >= 6100 && uc <= 6102) || (uc >= 6104 && uc <= 6106) ||
|
274
|
+
(uc >= 6144 && uc <= 6154) || uc == 6468 || uc == 6469 || uc == 6686 ||
|
275
|
+
uc == 6687 || (uc >= 6816 && uc <= 6822) || (uc >= 6824 && uc <= 6829) ||
|
276
|
+
(uc >= 7002 && uc <= 7008) || (uc >= 7164 && uc <= 7167) ||
|
277
|
+
(uc >= 7227 && uc <= 7231) || uc == 7294 || uc == 7295 ||
|
278
|
+
(uc >= 7360 && uc <= 7367) || uc == 7379 || (uc >= 8208 && uc <= 8231) ||
|
279
|
+
(uc >= 8240 && uc <= 8259) || (uc >= 8261 && uc <= 8273) ||
|
280
|
+
(uc >= 8275 && uc <= 8286) || uc == 8317 || uc == 8318 || uc == 8333 ||
|
281
|
+
uc == 8334 || (uc >= 8968 && uc <= 8971) || uc == 9001 || uc == 9002 ||
|
282
|
+
(uc >= 10088 && uc <= 10101) || uc == 10181 || uc == 10182 ||
|
283
|
+
(uc >= 10214 && uc <= 10223) || (uc >= 10627 && uc <= 10648) ||
|
284
|
+
(uc >= 10712 && uc <= 10715) || uc == 10748 || uc == 10749 ||
|
285
|
+
(uc >= 11513 && uc <= 11516) || uc == 11518 || uc == 11519 ||
|
286
|
+
uc == 11632 || (uc >= 11776 && uc <= 11822) ||
|
287
|
+
(uc >= 11824 && uc <= 11842) || (uc >= 12289 && uc <= 12291) ||
|
288
|
+
(uc >= 12296 && uc <= 12305) || (uc >= 12308 && uc <= 12319) ||
|
289
|
+
uc == 12336 || uc == 12349 || uc == 12448 || uc == 12539 || uc == 42238 ||
|
290
|
+
uc == 42239 || (uc >= 42509 && uc <= 42511) || uc == 42611 ||
|
291
|
+
uc == 42622 || (uc >= 42738 && uc <= 42743) ||
|
292
|
+
(uc >= 43124 && uc <= 43127) || uc == 43214 || uc == 43215 ||
|
293
|
+
(uc >= 43256 && uc <= 43258) || uc == 43310 || uc == 43311 ||
|
294
|
+
uc == 43359 || (uc >= 43457 && uc <= 43469) || uc == 43486 ||
|
295
|
+
uc == 43487 || (uc >= 43612 && uc <= 43615) || uc == 43742 ||
|
296
|
+
uc == 43743 || uc == 43760 || uc == 43761 || uc == 44011 || uc == 64830 ||
|
297
|
+
uc == 64831 || (uc >= 65040 && uc <= 65049) ||
|
298
|
+
(uc >= 65072 && uc <= 65106) || (uc >= 65108 && uc <= 65121) ||
|
299
|
+
uc == 65123 || uc == 65128 || uc == 65130 || uc == 65131 ||
|
300
|
+
(uc >= 65281 && uc <= 65283) || (uc >= 65285 && uc <= 65290) ||
|
301
|
+
(uc >= 65292 && uc <= 65295) || uc == 65306 || uc == 65307 ||
|
302
|
+
uc == 65311 || uc == 65312 || (uc >= 65339 && uc <= 65341) ||
|
303
|
+
uc == 65343 || uc == 65371 || uc == 65373 ||
|
304
|
+
(uc >= 65375 && uc <= 65381) || (uc >= 65792 && uc <= 65794) ||
|
305
|
+
uc == 66463 || uc == 66512 || uc == 66927 || uc == 67671 || uc == 67871 ||
|
306
|
+
uc == 67903 || (uc >= 68176 && uc <= 68184) || uc == 68223 ||
|
307
|
+
(uc >= 68336 && uc <= 68342) || (uc >= 68409 && uc <= 68415) ||
|
308
|
+
(uc >= 68505 && uc <= 68508) || (uc >= 69703 && uc <= 69709) ||
|
309
|
+
uc == 69819 || uc == 69820 || (uc >= 69822 && uc <= 69825) ||
|
310
|
+
(uc >= 69952 && uc <= 69955) || uc == 70004 || uc == 70005 ||
|
311
|
+
(uc >= 70085 && uc <= 70088) || uc == 70093 ||
|
312
|
+
(uc >= 70200 && uc <= 70205) || uc == 70854 ||
|
313
|
+
(uc >= 71105 && uc <= 71113) || (uc >= 71233 && uc <= 71235) ||
|
314
|
+
(uc >= 74864 && uc <= 74868) || uc == 92782 || uc == 92783 ||
|
315
|
+
uc == 92917 || (uc >= 92983 && uc <= 92987) || uc == 92996 ||
|
316
|
+
uc == 113823);
|
317
|
+
}
|
@@ -0,0 +1,35 @@
|
|
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
|
+
CMARK_EXPORT
|
12
|
+
void cmark_utf8proc_case_fold(cmark_strbuf *dest, const uint8_t *str,
|
13
|
+
bufsize_t len);
|
14
|
+
|
15
|
+
CMARK_EXPORT
|
16
|
+
void cmark_utf8proc_encode_char(int32_t uc, cmark_strbuf *buf);
|
17
|
+
|
18
|
+
CMARK_EXPORT
|
19
|
+
int cmark_utf8proc_iterate(const uint8_t *str, bufsize_t str_len, int32_t *dst);
|
20
|
+
|
21
|
+
CMARK_EXPORT
|
22
|
+
void cmark_utf8proc_check(cmark_strbuf *dest, const uint8_t *line,
|
23
|
+
bufsize_t size);
|
24
|
+
|
25
|
+
CMARK_EXPORT
|
26
|
+
int cmark_utf8proc_is_space(int32_t uc);
|
27
|
+
|
28
|
+
CMARK_EXPORT
|
29
|
+
int cmark_utf8proc_is_punctuation(int32_t uc);
|
30
|
+
|
31
|
+
#ifdef __cplusplus
|
32
|
+
}
|
33
|
+
#endif
|
34
|
+
|
35
|
+
#endif
|
@@ -0,0 +1,174 @@
|
|
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
|
+
#define BUFFER_SIZE 100
|
13
|
+
|
14
|
+
// Functions to convert cmark_nodes to XML strings.
|
15
|
+
|
16
|
+
static void escape_xml(cmark_strbuf *dest, const unsigned char *source,
|
17
|
+
bufsize_t length) {
|
18
|
+
houdini_escape_html0(dest, source, length, 0);
|
19
|
+
}
|
20
|
+
|
21
|
+
struct render_state {
|
22
|
+
cmark_strbuf *xml;
|
23
|
+
int indent;
|
24
|
+
};
|
25
|
+
|
26
|
+
static CMARK_INLINE void indent(struct render_state *state) {
|
27
|
+
int i;
|
28
|
+
for (i = 0; i < state->indent; i++) {
|
29
|
+
cmark_strbuf_putc(state->xml, ' ');
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
static int S_render_node(cmark_node *node, cmark_event_type ev_type,
|
34
|
+
struct render_state *state, int options) {
|
35
|
+
cmark_strbuf *xml = state->xml;
|
36
|
+
bool literal = false;
|
37
|
+
cmark_delim_type delim;
|
38
|
+
bool entering = (ev_type == CMARK_EVENT_ENTER);
|
39
|
+
char buffer[BUFFER_SIZE];
|
40
|
+
|
41
|
+
if (entering) {
|
42
|
+
indent(state);
|
43
|
+
cmark_strbuf_putc(xml, '<');
|
44
|
+
cmark_strbuf_puts(xml, cmark_node_get_type_string(node));
|
45
|
+
|
46
|
+
if (options & CMARK_OPT_SOURCEPOS && node->start_line != 0) {
|
47
|
+
snprintf(buffer, BUFFER_SIZE, " sourcepos=\"%d:%d-%d:%d\"",
|
48
|
+
node->start_line, node->start_column, node->end_line,
|
49
|
+
node->end_column);
|
50
|
+
cmark_strbuf_puts(xml, buffer);
|
51
|
+
}
|
52
|
+
|
53
|
+
literal = false;
|
54
|
+
|
55
|
+
switch (node->type) {
|
56
|
+
case CMARK_NODE_DOCUMENT:
|
57
|
+
cmark_strbuf_puts(xml, " xmlns=\"http://commonmark.org/xml/1.0\"");
|
58
|
+
break;
|
59
|
+
case CMARK_NODE_TEXT:
|
60
|
+
case CMARK_NODE_CODE:
|
61
|
+
case CMARK_NODE_HTML_BLOCK:
|
62
|
+
case CMARK_NODE_HTML_INLINE:
|
63
|
+
cmark_strbuf_puts(xml, ">");
|
64
|
+
escape_xml(xml, node->as.literal.data, node->as.literal.len);
|
65
|
+
cmark_strbuf_puts(xml, "</");
|
66
|
+
cmark_strbuf_puts(xml, cmark_node_get_type_string(node));
|
67
|
+
literal = true;
|
68
|
+
break;
|
69
|
+
case CMARK_NODE_LIST:
|
70
|
+
switch (cmark_node_get_list_type(node)) {
|
71
|
+
case CMARK_ORDERED_LIST:
|
72
|
+
cmark_strbuf_puts(xml, " type=\"ordered\"");
|
73
|
+
snprintf(buffer, BUFFER_SIZE, " start=\"%d\"",
|
74
|
+
cmark_node_get_list_start(node));
|
75
|
+
cmark_strbuf_puts(xml, buffer);
|
76
|
+
delim = cmark_node_get_list_delim(node);
|
77
|
+
if (delim == CMARK_PAREN_DELIM) {
|
78
|
+
cmark_strbuf_puts(xml, " delim=\"paren\"");
|
79
|
+
} else if (delim == CMARK_PERIOD_DELIM) {
|
80
|
+
cmark_strbuf_puts(xml, " delim=\"period\"");
|
81
|
+
}
|
82
|
+
break;
|
83
|
+
case CMARK_BULLET_LIST:
|
84
|
+
cmark_strbuf_puts(xml, " type=\"bullet\"");
|
85
|
+
break;
|
86
|
+
default:
|
87
|
+
break;
|
88
|
+
}
|
89
|
+
snprintf(buffer, BUFFER_SIZE, " tight=\"%s\"",
|
90
|
+
(cmark_node_get_list_tight(node) ? "true" : "false"));
|
91
|
+
cmark_strbuf_puts(xml, buffer);
|
92
|
+
break;
|
93
|
+
case CMARK_NODE_HEADING:
|
94
|
+
snprintf(buffer, BUFFER_SIZE, " level=\"%d\"", node->as.heading.level);
|
95
|
+
cmark_strbuf_puts(xml, buffer);
|
96
|
+
break;
|
97
|
+
case CMARK_NODE_CODE_BLOCK:
|
98
|
+
if (node->as.code.info.len > 0) {
|
99
|
+
cmark_strbuf_puts(xml, " info=\"");
|
100
|
+
escape_xml(xml, node->as.code.info.data, node->as.code.info.len);
|
101
|
+
cmark_strbuf_putc(xml, '"');
|
102
|
+
}
|
103
|
+
cmark_strbuf_puts(xml, ">");
|
104
|
+
escape_xml(xml, node->as.code.literal.data, node->as.code.literal.len);
|
105
|
+
cmark_strbuf_puts(xml, "</");
|
106
|
+
cmark_strbuf_puts(xml, cmark_node_get_type_string(node));
|
107
|
+
literal = true;
|
108
|
+
break;
|
109
|
+
case CMARK_NODE_CUSTOM_BLOCK:
|
110
|
+
case CMARK_NODE_CUSTOM_INLINE:
|
111
|
+
cmark_strbuf_puts(xml, " on_enter=\"");
|
112
|
+
escape_xml(xml, node->as.custom.on_enter.data,
|
113
|
+
node->as.custom.on_enter.len);
|
114
|
+
cmark_strbuf_putc(xml, '"');
|
115
|
+
cmark_strbuf_puts(xml, " on_exit=\"");
|
116
|
+
escape_xml(xml, node->as.custom.on_exit.data,
|
117
|
+
node->as.custom.on_exit.len);
|
118
|
+
cmark_strbuf_putc(xml, '"');
|
119
|
+
break;
|
120
|
+
case CMARK_NODE_LINK:
|
121
|
+
case CMARK_NODE_IMAGE:
|
122
|
+
cmark_strbuf_puts(xml, " destination=\"");
|
123
|
+
escape_xml(xml, node->as.link.url.data, node->as.link.url.len);
|
124
|
+
cmark_strbuf_putc(xml, '"');
|
125
|
+
cmark_strbuf_puts(xml, " title=\"");
|
126
|
+
escape_xml(xml, node->as.link.title.data, node->as.link.title.len);
|
127
|
+
cmark_strbuf_putc(xml, '"');
|
128
|
+
break;
|
129
|
+
default:
|
130
|
+
break;
|
131
|
+
}
|
132
|
+
if (node->first_child) {
|
133
|
+
state->indent += 2;
|
134
|
+
} else if (!literal) {
|
135
|
+
cmark_strbuf_puts(xml, " /");
|
136
|
+
}
|
137
|
+
cmark_strbuf_puts(xml, ">\n");
|
138
|
+
|
139
|
+
} else if (node->first_child) {
|
140
|
+
state->indent -= 2;
|
141
|
+
indent(state);
|
142
|
+
cmark_strbuf_puts(xml, "</");
|
143
|
+
cmark_strbuf_puts(xml, cmark_node_get_type_string(node));
|
144
|
+
cmark_strbuf_puts(xml, ">\n");
|
145
|
+
}
|
146
|
+
|
147
|
+
return 1;
|
148
|
+
}
|
149
|
+
|
150
|
+
char *cmark_render_xml(cmark_node *root, int options) {
|
151
|
+
return cmark_render_xml_with_mem(root, options, cmark_node_mem(root));
|
152
|
+
}
|
153
|
+
|
154
|
+
char *cmark_render_xml_with_mem(cmark_node *root, int options, cmark_mem *mem) {
|
155
|
+
char *result;
|
156
|
+
cmark_strbuf xml = CMARK_BUF_INIT(mem);
|
157
|
+
cmark_event_type ev_type;
|
158
|
+
cmark_node *cur;
|
159
|
+
struct render_state state = {&xml, 0};
|
160
|
+
|
161
|
+
cmark_iter *iter = cmark_iter_new(root);
|
162
|
+
|
163
|
+
cmark_strbuf_puts(state.xml, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
164
|
+
cmark_strbuf_puts(state.xml,
|
165
|
+
"<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n");
|
166
|
+
while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) {
|
167
|
+
cur = cmark_iter_get_node(iter);
|
168
|
+
S_render_node(cur, ev_type, &state, options);
|
169
|
+
}
|
170
|
+
result = (char *)cmark_strbuf_detach(&xml);
|
171
|
+
|
172
|
+
cmark_iter_free(iter);
|
173
|
+
return result;
|
174
|
+
}
|