commonmarker 0.17.7 → 0.17.7.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 +4 -4
- data/commonmarker.gemspec +1 -1
- data/lib/commonmarker/version.rb +1 -1
- metadata +2 -335
- data/ext/commonmarker/cmark-upstream/CMakeLists.txt +0 -44
- data/ext/commonmarker/cmark-upstream/COPYING +0 -170
- data/ext/commonmarker/cmark-upstream/FindAsan.cmake +0 -74
- data/ext/commonmarker/cmark-upstream/Makefile +0 -226
- data/ext/commonmarker/cmark-upstream/Makefile.nmake +0 -36
- data/ext/commonmarker/cmark-upstream/README.md +0 -206
- data/ext/commonmarker/cmark-upstream/api_test/CMakeLists.txt +0 -26
- data/ext/commonmarker/cmark-upstream/api_test/cplusplus.cpp +0 -15
- data/ext/commonmarker/cmark-upstream/api_test/cplusplus.h +0 -16
- data/ext/commonmarker/cmark-upstream/api_test/harness.c +0 -110
- data/ext/commonmarker/cmark-upstream/api_test/harness.h +0 -35
- data/ext/commonmarker/cmark-upstream/api_test/main.c +0 -1116
- data/ext/commonmarker/cmark-upstream/appveyor.yml +0 -17
- data/ext/commonmarker/cmark-upstream/bench/samples/block-bq-flat.md +0 -16
- data/ext/commonmarker/cmark-upstream/bench/samples/block-bq-nested.md +0 -13
- data/ext/commonmarker/cmark-upstream/bench/samples/block-code.md +0 -11
- data/ext/commonmarker/cmark-upstream/bench/samples/block-fences.md +0 -14
- data/ext/commonmarker/cmark-upstream/bench/samples/block-heading.md +0 -9
- data/ext/commonmarker/cmark-upstream/bench/samples/block-hr.md +0 -10
- data/ext/commonmarker/cmark-upstream/bench/samples/block-html.md +0 -32
- data/ext/commonmarker/cmark-upstream/bench/samples/block-lheading.md +0 -8
- data/ext/commonmarker/cmark-upstream/bench/samples/block-list-flat.md +0 -67
- data/ext/commonmarker/cmark-upstream/bench/samples/block-list-nested.md +0 -36
- data/ext/commonmarker/cmark-upstream/bench/samples/block-ref-flat.md +0 -15
- data/ext/commonmarker/cmark-upstream/bench/samples/block-ref-nested.md +0 -17
- data/ext/commonmarker/cmark-upstream/bench/samples/inline-autolink.md +0 -14
- data/ext/commonmarker/cmark-upstream/bench/samples/inline-backticks.md +0 -3
- data/ext/commonmarker/cmark-upstream/bench/samples/inline-em-flat.md +0 -5
- data/ext/commonmarker/cmark-upstream/bench/samples/inline-em-nested.md +0 -5
- data/ext/commonmarker/cmark-upstream/bench/samples/inline-em-worst.md +0 -5
- data/ext/commonmarker/cmark-upstream/bench/samples/inline-entity.md +0 -11
- data/ext/commonmarker/cmark-upstream/bench/samples/inline-escape.md +0 -15
- data/ext/commonmarker/cmark-upstream/bench/samples/inline-html.md +0 -44
- data/ext/commonmarker/cmark-upstream/bench/samples/inline-links-flat.md +0 -23
- data/ext/commonmarker/cmark-upstream/bench/samples/inline-links-nested.md +0 -13
- data/ext/commonmarker/cmark-upstream/bench/samples/inline-newlines.md +0 -24
- data/ext/commonmarker/cmark-upstream/bench/samples/lorem1.md +0 -13
- data/ext/commonmarker/cmark-upstream/bench/samples/rawtabs.md +0 -18
- data/ext/commonmarker/cmark-upstream/bench/statistics.py +0 -595
- data/ext/commonmarker/cmark-upstream/bench/stats.py +0 -19
- data/ext/commonmarker/cmark-upstream/benchmarks.md +0 -33
- data/ext/commonmarker/cmark-upstream/build/CMakeCache.txt +0 -478
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CMakeCCompiler.cmake +0 -71
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CMakeCXXCompiler.cmake +0 -73
- 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 +0 -15
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CompilerIdC/CMakeCCompilerId.c +0 -567
- 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 +0 -539
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CompilerIdCXX/a.out +0 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/CMakeDirectoryInformation.cmake +0 -16
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/CMakeError.log +0 -18
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/CMakeOutput.log +0 -709
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/Makefile.cmake +0 -157
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/Makefile2 +0 -391
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/TargetDirectories.txt +0 -48
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/cmake.check_cache +0 -1
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/feature_tests.bin +0 -0
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/feature_tests.c +0 -34
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/feature_tests.cxx +0 -405
- data/ext/commonmarker/cmark-upstream/build/CMakeFiles/progress.marks +0 -1
- data/ext/commonmarker/cmark-upstream/build/CTestTestfile.cmake +0 -11
- data/ext/commonmarker/cmark-upstream/build/Makefile +0 -280
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/CMakeDirectoryInformation.cmake +0 -16
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/C.includecache +0 -134
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/CXX.includecache +0 -38
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/DependInfo.cmake +0 -38
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/build.make +0 -169
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/cmake_clean.cmake +0 -12
- 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 +0 -28
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/depend.make +0 -28
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/flags.make +0 -17
- 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 +0 -1
- 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 +0 -5
- data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/progress.marks +0 -1
- data/ext/commonmarker/cmark-upstream/build/api_test/Makefile +0 -302
- data/ext/commonmarker/cmark-upstream/build/api_test/api_test +0 -0
- data/ext/commonmarker/cmark-upstream/build/api_test/cmake_install.cmake +0 -29
- data/ext/commonmarker/cmark-upstream/build/cmake_install.cmake +0 -49
- data/ext/commonmarker/cmark-upstream/build/compile_commands.json +0 -352
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/CMakeDirectoryInformation.cmake +0 -16
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/Export/lib/cmake-gfmextensions/cmark-gfmextensions-release.cmake +0 -30
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/Export/lib/cmake-gfmextensions/cmark-gfmextensions.cmake +0 -108
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/C.includecache +0 -246
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/DependInfo.cmake +0 -36
- 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 +0 -253
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/cmake_clean.cmake +0 -16
- 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 +0 -96
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/depend.make +0 -96
- 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 +0 -10
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/link.txt +0 -1
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/progress.make +0 -8
- 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 +0 -246
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/DependInfo.cmake +0 -29
- 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 +0 -249
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/cmake_clean.cmake +0 -15
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/cmake_clean_target.cmake +0 -3
- 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 +0 -96
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/depend.make +0 -96
- 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 +0 -10
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/link.txt +0 -2
- data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/progress.make +0 -8
- 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 +0 -1
- data/ext/commonmarker/cmark-upstream/build/extensions/Makefile +0 -426
- data/ext/commonmarker/cmark-upstream/build/extensions/cmake_install.cmake +0 -84
- data/ext/commonmarker/cmark-upstream/build/extensions/cmarkextensions_export.h +0 -42
- 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 +0 -1
- data/ext/commonmarker/cmark-upstream/build/man/CMakeFiles/CMakeDirectoryInformation.cmake +0 -16
- data/ext/commonmarker/cmark-upstream/build/man/CMakeFiles/progress.marks +0 -1
- data/ext/commonmarker/cmark-upstream/build/man/Makefile +0 -196
- data/ext/commonmarker/cmark-upstream/build/man/cmake_install.cmake +0 -37
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/CMakeDirectoryInformation.cmake +0 -16
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/Export/lib/cmake/cmark-gfm-release.cmake +0 -38
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/Export/lib/cmake/cmark-gfm.cmake +0 -95
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/C.includecache +0 -156
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/DependInfo.cmake +0 -30
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/build.make +0 -115
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/cmake_clean.cmake +0 -10
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/depend.internal +0 -20
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/depend.make +0 -20
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/flags.make +0 -10
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/link.txt +0 -1
- 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 +0 -3
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/C.includecache +0 -612
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/DependInfo.cmake +0 -60
- 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 +0 -819
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/cmake_clean.cmake +0 -37
- 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 +0 -319
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/depend.make +0 -319
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/flags.make +0 -10
- 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 +0 -1
- 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 +0 -29
- 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 +0 -612
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/DependInfo.cmake +0 -54
- 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 +0 -816
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/cmake_clean.cmake +0 -36
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/cmake_clean_target.cmake +0 -3
- 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 +0 -319
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/depend.make +0 -319
- data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/flags.make +0 -10
- 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 +0 -2
- 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 +0 -29
- 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 +0 -1
- data/ext/commonmarker/cmark-upstream/build/src/Makefile +0 -1165
- data/ext/commonmarker/cmark-upstream/build/src/cmake_install.cmake +0 -97
- data/ext/commonmarker/cmark-upstream/build/src/cmark-gfm +0 -0
- data/ext/commonmarker/cmark-upstream/build/src/cmark_export.h +0 -42
- data/ext/commonmarker/cmark-upstream/build/src/cmark_version.h +0 -8
- data/ext/commonmarker/cmark-upstream/build/src/config.h +0 -76
- 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 +0 -1
- data/ext/commonmarker/cmark-upstream/build/src/libcmark-gfm.pc +0 -10
- data/ext/commonmarker/cmark-upstream/build/testdir/CMakeFiles/CMakeDirectoryInformation.cmake +0 -16
- data/ext/commonmarker/cmark-upstream/build/testdir/CMakeFiles/progress.marks +0 -1
- data/ext/commonmarker/cmark-upstream/build/testdir/CTestTestfile.cmake +0 -17
- data/ext/commonmarker/cmark-upstream/build/testdir/Makefile +0 -196
- data/ext/commonmarker/cmark-upstream/build/testdir/cmake_install.cmake +0 -29
- data/ext/commonmarker/cmark-upstream/changelog.txt +0 -964
- data/ext/commonmarker/cmark-upstream/data/CaseFolding.txt +0 -1495
- data/ext/commonmarker/cmark-upstream/extensions/CMakeLists.txt +0 -124
- data/ext/commonmarker/cmark-upstream/extensions/autolink.c +0 -421
- data/ext/commonmarker/cmark-upstream/extensions/autolink.h +0 -8
- data/ext/commonmarker/cmark-upstream/extensions/core-extensions.c +0 -25
- data/ext/commonmarker/cmark-upstream/extensions/core-extensions.h +0 -25
- data/ext/commonmarker/cmark-upstream/extensions/ext_scanners.c +0 -941
- data/ext/commonmarker/cmark-upstream/extensions/ext_scanners.h +0 -22
- data/ext/commonmarker/cmark-upstream/extensions/ext_scanners.re +0 -74
- data/ext/commonmarker/cmark-upstream/extensions/strikethrough.c +0 -157
- data/ext/commonmarker/cmark-upstream/extensions/strikethrough.h +0 -9
- data/ext/commonmarker/cmark-upstream/extensions/table.c +0 -683
- data/ext/commonmarker/cmark-upstream/extensions/table.h +0 -8
- data/ext/commonmarker/cmark-upstream/extensions/tagfilter.c +0 -60
- data/ext/commonmarker/cmark-upstream/extensions/tagfilter.h +0 -8
- data/ext/commonmarker/cmark-upstream/man/CMakeLists.txt +0 -10
- data/ext/commonmarker/cmark-upstream/man/make_man_page.py +0 -133
- data/ext/commonmarker/cmark-upstream/man/man1/cmark-gfm.1 +0 -78
- data/ext/commonmarker/cmark-upstream/man/man3/cmark-gfm.3 +0 -989
- data/ext/commonmarker/cmark-upstream/nmake.bat +0 -1
- data/ext/commonmarker/cmark-upstream/src/CMakeLists.txt +0 -224
- data/ext/commonmarker/cmark-upstream/src/arena.c +0 -103
- data/ext/commonmarker/cmark-upstream/src/blocks.c +0 -1519
- data/ext/commonmarker/cmark-upstream/src/buffer.c +0 -279
- data/ext/commonmarker/cmark-upstream/src/buffer.h +0 -116
- data/ext/commonmarker/cmark-upstream/src/case_fold_switch.inc +0 -4327
- data/ext/commonmarker/cmark-upstream/src/chunk.h +0 -136
- data/ext/commonmarker/cmark-upstream/src/cmark.c +0 -55
- data/ext/commonmarker/cmark-upstream/src/cmark.h +0 -789
- data/ext/commonmarker/cmark-upstream/src/cmark_ctype.c +0 -44
- data/ext/commonmarker/cmark-upstream/src/cmark_ctype.h +0 -33
- data/ext/commonmarker/cmark-upstream/src/cmark_extension_api.h +0 -719
- data/ext/commonmarker/cmark-upstream/src/cmark_version.h.in +0 -8
- data/ext/commonmarker/cmark-upstream/src/commonmark.c +0 -508
- data/ext/commonmarker/cmark-upstream/src/config.h.in +0 -76
- data/ext/commonmarker/cmark-upstream/src/entities.inc +0 -2138
- data/ext/commonmarker/cmark-upstream/src/footnotes.c +0 -40
- data/ext/commonmarker/cmark-upstream/src/footnotes.h +0 -25
- data/ext/commonmarker/cmark-upstream/src/houdini.h +0 -57
- data/ext/commonmarker/cmark-upstream/src/houdini_href_e.c +0 -100
- data/ext/commonmarker/cmark-upstream/src/houdini_html_e.c +0 -66
- data/ext/commonmarker/cmark-upstream/src/houdini_html_u.c +0 -149
- data/ext/commonmarker/cmark-upstream/src/html.c +0 -457
- data/ext/commonmarker/cmark-upstream/src/html.h +0 -27
- data/ext/commonmarker/cmark-upstream/src/inlines.c +0 -1594
- data/ext/commonmarker/cmark-upstream/src/inlines.h +0 -29
- data/ext/commonmarker/cmark-upstream/src/iterator.c +0 -159
- data/ext/commonmarker/cmark-upstream/src/iterator.h +0 -27
- data/ext/commonmarker/cmark-upstream/src/latex.c +0 -466
- data/ext/commonmarker/cmark-upstream/src/libcmark-gfm.pc.in +0 -10
- data/ext/commonmarker/cmark-upstream/src/linked_list.c +0 -37
- data/ext/commonmarker/cmark-upstream/src/main.c +0 -276
- data/ext/commonmarker/cmark-upstream/src/man.c +0 -278
- data/ext/commonmarker/cmark-upstream/src/map.c +0 -122
- data/ext/commonmarker/cmark-upstream/src/map.h +0 -42
- data/ext/commonmarker/cmark-upstream/src/node.c +0 -965
- data/ext/commonmarker/cmark-upstream/src/node.h +0 -116
- data/ext/commonmarker/cmark-upstream/src/parser.h +0 -57
- data/ext/commonmarker/cmark-upstream/src/plaintext.c +0 -213
- data/ext/commonmarker/cmark-upstream/src/plugin.c +0 -36
- data/ext/commonmarker/cmark-upstream/src/plugin.h +0 -34
- data/ext/commonmarker/cmark-upstream/src/references.c +0 -42
- data/ext/commonmarker/cmark-upstream/src/references.h +0 -26
- data/ext/commonmarker/cmark-upstream/src/registry.c +0 -63
- data/ext/commonmarker/cmark-upstream/src/registry.h +0 -24
- data/ext/commonmarker/cmark-upstream/src/render.c +0 -202
- data/ext/commonmarker/cmark-upstream/src/render.h +0 -63
- data/ext/commonmarker/cmark-upstream/src/scanners.c +0 -18195
- data/ext/commonmarker/cmark-upstream/src/scanners.h +0 -64
- data/ext/commonmarker/cmark-upstream/src/scanners.re +0 -341
- data/ext/commonmarker/cmark-upstream/src/syntax_extension.c +0 -139
- data/ext/commonmarker/cmark-upstream/src/syntax_extension.h +0 -32
- data/ext/commonmarker/cmark-upstream/src/utf8.c +0 -317
- data/ext/commonmarker/cmark-upstream/src/utf8.h +0 -35
- data/ext/commonmarker/cmark-upstream/src/xml.c +0 -174
- data/ext/commonmarker/cmark-upstream/suppressions +0 -10
- data/ext/commonmarker/cmark-upstream/test/CMakeLists.txt +0 -98
- data/ext/commonmarker/cmark-upstream/test/afl_test_cases/test.md +0 -49
- data/ext/commonmarker/cmark-upstream/test/cmark-fuzz.c +0 -28
- data/ext/commonmarker/cmark-upstream/test/cmark.py +0 -103
- data/ext/commonmarker/cmark-upstream/test/entity_tests.py +0 -67
- data/ext/commonmarker/cmark-upstream/test/extensions.txt +0 -674
- data/ext/commonmarker/cmark-upstream/test/fuzzing_dictionary +0 -49
- data/ext/commonmarker/cmark-upstream/test/normalize.py +0 -194
- data/ext/commonmarker/cmark-upstream/test/pathological_tests.py +0 -145
- data/ext/commonmarker/cmark-upstream/test/regression.txt +0 -128
- data/ext/commonmarker/cmark-upstream/test/roundtrip_tests.py +0 -50
- data/ext/commonmarker/cmark-upstream/test/run-cmark-fuzz +0 -4
- data/ext/commonmarker/cmark-upstream/test/smart_punct.txt +0 -177
- data/ext/commonmarker/cmark-upstream/test/spec.txt +0 -9919
- data/ext/commonmarker/cmark-upstream/test/spec_tests.py +0 -152
- data/ext/commonmarker/cmark-upstream/toolchain-mingw32.cmake +0 -17
- data/ext/commonmarker/cmark-upstream/tools/Dockerfile +0 -41
- data/ext/commonmarker/cmark-upstream/tools/appveyor-build.bat +0 -13
- data/ext/commonmarker/cmark-upstream/tools/make_entities_inc.py +0 -32
- data/ext/commonmarker/cmark-upstream/tools/mkcasefold.pl +0 -22
- data/ext/commonmarker/cmark-upstream/why-cmark-and-not-x.md +0 -104
- data/ext/commonmarker/cmark-upstream/wrappers/wrapper.js +0 -6
- data/ext/commonmarker/cmark-upstream/wrappers/wrapper.py +0 -37
- data/ext/commonmarker/cmark-upstream/wrappers/wrapper.rb +0 -15
- data/ext/commonmarker/cmark-upstream/wrappers/wrapper.rkt +0 -190
@@ -1,40 +0,0 @@
|
|
1
|
-
#include "cmark.h"
|
2
|
-
#include "parser.h"
|
3
|
-
#include "footnotes.h"
|
4
|
-
#include "inlines.h"
|
5
|
-
#include "chunk.h"
|
6
|
-
|
7
|
-
static void footnote_free(cmark_map *map, cmark_map_entry *_ref) {
|
8
|
-
cmark_footnote *ref = (cmark_footnote *)_ref;
|
9
|
-
cmark_mem *mem = map->mem;
|
10
|
-
if (ref != NULL) {
|
11
|
-
mem->free(ref->entry.label);
|
12
|
-
if (ref->node)
|
13
|
-
cmark_node_free(ref->node);
|
14
|
-
mem->free(ref);
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
18
|
-
void cmark_footnote_create(cmark_map *map, cmark_node *node) {
|
19
|
-
cmark_footnote *ref;
|
20
|
-
unsigned char *reflabel = normalize_map_label(map->mem, &node->as.literal);
|
21
|
-
|
22
|
-
/* empty footnote name, or composed from only whitespace */
|
23
|
-
if (reflabel == NULL)
|
24
|
-
return;
|
25
|
-
|
26
|
-
assert(map->sorted == NULL);
|
27
|
-
|
28
|
-
ref = (cmark_footnote *)map->mem->calloc(1, sizeof(*ref));
|
29
|
-
ref->entry.label = reflabel;
|
30
|
-
ref->node = node;
|
31
|
-
ref->entry.age = map->size;
|
32
|
-
ref->entry.next = map->refs;
|
33
|
-
|
34
|
-
map->refs = (cmark_map_entry *)ref;
|
35
|
-
map->size++;
|
36
|
-
}
|
37
|
-
|
38
|
-
cmark_map *cmark_footnote_map_new(cmark_mem *mem) {
|
39
|
-
return cmark_map_new(mem, footnote_free);
|
40
|
-
}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
#ifndef CMARK_FOOTNOTES_H
|
2
|
-
#define CMARK_FOOTNOTES_H
|
3
|
-
|
4
|
-
#include "map.h"
|
5
|
-
|
6
|
-
#ifdef __cplusplus
|
7
|
-
extern "C" {
|
8
|
-
#endif
|
9
|
-
|
10
|
-
struct cmark_footnote {
|
11
|
-
cmark_map_entry entry;
|
12
|
-
cmark_node *node;
|
13
|
-
unsigned int ix;
|
14
|
-
};
|
15
|
-
|
16
|
-
typedef struct cmark_footnote cmark_footnote;
|
17
|
-
|
18
|
-
void cmark_footnote_create(cmark_map *map, cmark_node *node);
|
19
|
-
cmark_map *cmark_footnote_map_new(cmark_mem *mem);
|
20
|
-
|
21
|
-
#ifdef __cplusplus
|
22
|
-
}
|
23
|
-
#endif
|
24
|
-
|
25
|
-
#endif
|
@@ -1,57 +0,0 @@
|
|
1
|
-
#ifndef CMARK_HOUDINI_H
|
2
|
-
#define CMARK_HOUDINI_H
|
3
|
-
|
4
|
-
#ifdef __cplusplus
|
5
|
-
extern "C" {
|
6
|
-
#endif
|
7
|
-
|
8
|
-
#include <stdint.h>
|
9
|
-
#include "config.h"
|
10
|
-
#include "buffer.h"
|
11
|
-
|
12
|
-
#ifdef HAVE___BUILTIN_EXPECT
|
13
|
-
#define likely(x) __builtin_expect((x), 1)
|
14
|
-
#define unlikely(x) __builtin_expect((x), 0)
|
15
|
-
#else
|
16
|
-
#define likely(x) (x)
|
17
|
-
#define unlikely(x) (x)
|
18
|
-
#endif
|
19
|
-
|
20
|
-
#ifdef HOUDINI_USE_LOCALE
|
21
|
-
#define _isxdigit(c) isxdigit(c)
|
22
|
-
#define _isdigit(c) isdigit(c)
|
23
|
-
#else
|
24
|
-
/*
|
25
|
-
* Helper _isdigit methods -- do not trust the current locale
|
26
|
-
* */
|
27
|
-
#define _isxdigit(c) (strchr("0123456789ABCDEFabcdef", (c)) != NULL)
|
28
|
-
#define _isdigit(c) ((c) >= '0' && (c) <= '9')
|
29
|
-
#endif
|
30
|
-
|
31
|
-
#define HOUDINI_ESCAPED_SIZE(x) (((x)*12) / 10)
|
32
|
-
#define HOUDINI_UNESCAPED_SIZE(x) (x)
|
33
|
-
|
34
|
-
CMARK_EXPORT
|
35
|
-
bufsize_t houdini_unescape_ent(cmark_strbuf *ob, const uint8_t *src,
|
36
|
-
bufsize_t size);
|
37
|
-
CMARK_EXPORT
|
38
|
-
int houdini_escape_html(cmark_strbuf *ob, const uint8_t *src,
|
39
|
-
bufsize_t size);
|
40
|
-
CMARK_EXPORT
|
41
|
-
int houdini_escape_html0(cmark_strbuf *ob, const uint8_t *src,
|
42
|
-
bufsize_t size, int secure);
|
43
|
-
CMARK_EXPORT
|
44
|
-
int houdini_unescape_html(cmark_strbuf *ob, const uint8_t *src,
|
45
|
-
bufsize_t size);
|
46
|
-
CMARK_EXPORT
|
47
|
-
void houdini_unescape_html_f(cmark_strbuf *ob, const uint8_t *src,
|
48
|
-
bufsize_t size);
|
49
|
-
CMARK_EXPORT
|
50
|
-
int houdini_escape_href(cmark_strbuf *ob, const uint8_t *src,
|
51
|
-
bufsize_t size);
|
52
|
-
|
53
|
-
#ifdef __cplusplus
|
54
|
-
}
|
55
|
-
#endif
|
56
|
-
|
57
|
-
#endif
|
@@ -1,100 +0,0 @@
|
|
1
|
-
#include <assert.h>
|
2
|
-
#include <stdio.h>
|
3
|
-
#include <string.h>
|
4
|
-
|
5
|
-
#include "houdini.h"
|
6
|
-
|
7
|
-
/*
|
8
|
-
* The following characters will not be escaped:
|
9
|
-
*
|
10
|
-
* -_.+!*'(),%#@?=;:/,+&$ alphanum
|
11
|
-
*
|
12
|
-
* Note that this character set is the addition of:
|
13
|
-
*
|
14
|
-
* - The characters which are safe to be in an URL
|
15
|
-
* - The characters which are *not* safe to be in
|
16
|
-
* an URL because they are RESERVED characters.
|
17
|
-
*
|
18
|
-
* We asume (lazily) that any RESERVED char that
|
19
|
-
* appears inside an URL is actually meant to
|
20
|
-
* have its native function (i.e. as an URL
|
21
|
-
* component/separator) and hence needs no escaping.
|
22
|
-
*
|
23
|
-
* There are two exceptions: the chacters & (amp)
|
24
|
-
* and ' (single quote) do not appear in the table.
|
25
|
-
* They are meant to appear in the URL as components,
|
26
|
-
* yet they require special HTML-entity escaping
|
27
|
-
* to generate valid HTML markup.
|
28
|
-
*
|
29
|
-
* All other characters will be escaped to %XX.
|
30
|
-
*
|
31
|
-
*/
|
32
|
-
static const char HREF_SAFE[] = {
|
33
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
34
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
|
35
|
-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
36
|
-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,
|
37
|
-
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
38
|
-
1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
39
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
40
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
41
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
42
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
43
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
44
|
-
};
|
45
|
-
|
46
|
-
int houdini_escape_href(cmark_strbuf *ob, const uint8_t *src, bufsize_t size) {
|
47
|
-
static const uint8_t hex_chars[] = "0123456789ABCDEF";
|
48
|
-
bufsize_t i = 0, org;
|
49
|
-
uint8_t hex_str[3];
|
50
|
-
|
51
|
-
hex_str[0] = '%';
|
52
|
-
|
53
|
-
while (i < size) {
|
54
|
-
org = i;
|
55
|
-
while (i < size && HREF_SAFE[src[i]] != 0)
|
56
|
-
i++;
|
57
|
-
|
58
|
-
if (likely(i > org))
|
59
|
-
cmark_strbuf_put(ob, src + org, i - org);
|
60
|
-
|
61
|
-
/* escaping */
|
62
|
-
if (i >= size)
|
63
|
-
break;
|
64
|
-
|
65
|
-
switch (src[i]) {
|
66
|
-
/* amp appears all the time in URLs, but needs
|
67
|
-
* HTML-entity escaping to be inside an href */
|
68
|
-
case '&':
|
69
|
-
cmark_strbuf_puts(ob, "&");
|
70
|
-
break;
|
71
|
-
|
72
|
-
/* the single quote is a valid URL character
|
73
|
-
* according to the standard; it needs HTML
|
74
|
-
* entity escaping too */
|
75
|
-
case '\'':
|
76
|
-
cmark_strbuf_puts(ob, "'");
|
77
|
-
break;
|
78
|
-
|
79
|
-
/* the space can be escaped to %20 or a plus
|
80
|
-
* sign. we're going with the generic escape
|
81
|
-
* for now. the plus thing is more commonly seen
|
82
|
-
* when building GET strings */
|
83
|
-
#if 0
|
84
|
-
case ' ':
|
85
|
-
cmark_strbuf_putc(ob, '+');
|
86
|
-
break;
|
87
|
-
#endif
|
88
|
-
|
89
|
-
/* every other character goes with a %XX escaping */
|
90
|
-
default:
|
91
|
-
hex_str[1] = hex_chars[(src[i] >> 4) & 0xF];
|
92
|
-
hex_str[2] = hex_chars[src[i] & 0xF];
|
93
|
-
cmark_strbuf_put(ob, hex_str, 3);
|
94
|
-
}
|
95
|
-
|
96
|
-
i++;
|
97
|
-
}
|
98
|
-
|
99
|
-
return 1;
|
100
|
-
}
|
@@ -1,66 +0,0 @@
|
|
1
|
-
#include <assert.h>
|
2
|
-
#include <stdio.h>
|
3
|
-
#include <string.h>
|
4
|
-
|
5
|
-
#include "houdini.h"
|
6
|
-
|
7
|
-
/**
|
8
|
-
* According to the OWASP rules:
|
9
|
-
*
|
10
|
-
* & --> &
|
11
|
-
* < --> <
|
12
|
-
* > --> >
|
13
|
-
* " --> "
|
14
|
-
* ' --> ' ' is not recommended
|
15
|
-
* / --> / forward slash is included as it helps end an HTML entity
|
16
|
-
*
|
17
|
-
*/
|
18
|
-
static const char HTML_ESCAPE_TABLE[] = {
|
19
|
-
0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 0, 0, 0, 2, 3, 0, 0, 0, 0, 0, 0, 0, 4,
|
21
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
22
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
23
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
24
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
25
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
26
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
27
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
28
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
30
|
-
};
|
31
|
-
|
32
|
-
static const char *HTML_ESCAPES[] = {"", """, "&", "'",
|
33
|
-
"/", "<", ">"};
|
34
|
-
|
35
|
-
int houdini_escape_html0(cmark_strbuf *ob, const uint8_t *src, bufsize_t size,
|
36
|
-
int secure) {
|
37
|
-
bufsize_t i = 0, org, esc = 0;
|
38
|
-
|
39
|
-
while (i < size) {
|
40
|
-
org = i;
|
41
|
-
while (i < size && (esc = HTML_ESCAPE_TABLE[src[i]]) == 0)
|
42
|
-
i++;
|
43
|
-
|
44
|
-
if (i > org)
|
45
|
-
cmark_strbuf_put(ob, src + org, i - org);
|
46
|
-
|
47
|
-
/* escaping */
|
48
|
-
if (unlikely(i >= size))
|
49
|
-
break;
|
50
|
-
|
51
|
-
/* The forward slash and single quote are only escaped in secure mode */
|
52
|
-
if ((src[i] == '/' || src[i] == '\'') && !secure) {
|
53
|
-
cmark_strbuf_putc(ob, src[i]);
|
54
|
-
} else {
|
55
|
-
cmark_strbuf_puts(ob, HTML_ESCAPES[esc]);
|
56
|
-
}
|
57
|
-
|
58
|
-
i++;
|
59
|
-
}
|
60
|
-
|
61
|
-
return 1;
|
62
|
-
}
|
63
|
-
|
64
|
-
int houdini_escape_html(cmark_strbuf *ob, const uint8_t *src, bufsize_t size) {
|
65
|
-
return houdini_escape_html0(ob, src, size, 1);
|
66
|
-
}
|
@@ -1,149 +0,0 @@
|
|
1
|
-
#include <assert.h>
|
2
|
-
#include <stdio.h>
|
3
|
-
#include <string.h>
|
4
|
-
|
5
|
-
#include "buffer.h"
|
6
|
-
#include "houdini.h"
|
7
|
-
#include "utf8.h"
|
8
|
-
#include "entities.inc"
|
9
|
-
|
10
|
-
/* Binary tree lookup code for entities added by JGM */
|
11
|
-
|
12
|
-
static const unsigned char *S_lookup(int i, int low, int hi,
|
13
|
-
const unsigned char *s, int len) {
|
14
|
-
int j;
|
15
|
-
int cmp =
|
16
|
-
strncmp((const char *)s, (const char *)cmark_entities[i].entity, len);
|
17
|
-
if (cmp == 0 && cmark_entities[i].entity[len] == 0) {
|
18
|
-
return (const unsigned char *)cmark_entities[i].bytes;
|
19
|
-
} else if (cmp <= 0 && i > low) {
|
20
|
-
j = i - ((i - low) / 2);
|
21
|
-
if (j == i)
|
22
|
-
j -= 1;
|
23
|
-
return S_lookup(j, low, i - 1, s, len);
|
24
|
-
} else if (cmp > 0 && i < hi) {
|
25
|
-
j = i + ((hi - i) / 2);
|
26
|
-
if (j == i)
|
27
|
-
j += 1;
|
28
|
-
return S_lookup(j, i + 1, hi, s, len);
|
29
|
-
} else {
|
30
|
-
return NULL;
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
|
-
static const unsigned char *S_lookup_entity(const unsigned char *s, int len) {
|
35
|
-
return S_lookup(CMARK_NUM_ENTITIES / 2, 0, CMARK_NUM_ENTITIES - 1, s, len);
|
36
|
-
}
|
37
|
-
|
38
|
-
bufsize_t houdini_unescape_ent(cmark_strbuf *ob, const uint8_t *src,
|
39
|
-
bufsize_t size) {
|
40
|
-
bufsize_t i = 0;
|
41
|
-
|
42
|
-
if (size >= 3 && src[0] == '#') {
|
43
|
-
int codepoint = 0;
|
44
|
-
int num_digits = 0;
|
45
|
-
|
46
|
-
if (_isdigit(src[1])) {
|
47
|
-
for (i = 1; i < size && _isdigit(src[i]); ++i) {
|
48
|
-
codepoint = (codepoint * 10) + (src[i] - '0');
|
49
|
-
|
50
|
-
if (codepoint >= 0x110000) {
|
51
|
-
// Keep counting digits but
|
52
|
-
// avoid integer overflow.
|
53
|
-
codepoint = 0x110000;
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
|
-
num_digits = i - 1;
|
58
|
-
}
|
59
|
-
|
60
|
-
else if (src[1] == 'x' || src[1] == 'X') {
|
61
|
-
for (i = 2; i < size && _isxdigit(src[i]); ++i) {
|
62
|
-
codepoint = (codepoint * 16) + ((src[i] | 32) % 39 - 9);
|
63
|
-
|
64
|
-
if (codepoint >= 0x110000) {
|
65
|
-
// Keep counting digits but
|
66
|
-
// avoid integer overflow.
|
67
|
-
codepoint = 0x110000;
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
num_digits = i - 2;
|
72
|
-
}
|
73
|
-
|
74
|
-
if (num_digits >= 1 && num_digits <= 8 && i < size && src[i] == ';') {
|
75
|
-
if (codepoint == 0 || (codepoint >= 0xD800 && codepoint < 0xE000) ||
|
76
|
-
codepoint >= 0x110000) {
|
77
|
-
codepoint = 0xFFFD;
|
78
|
-
}
|
79
|
-
cmark_utf8proc_encode_char(codepoint, ob);
|
80
|
-
return i + 1;
|
81
|
-
}
|
82
|
-
}
|
83
|
-
|
84
|
-
else {
|
85
|
-
if (size > CMARK_ENTITY_MAX_LENGTH)
|
86
|
-
size = CMARK_ENTITY_MAX_LENGTH;
|
87
|
-
|
88
|
-
for (i = CMARK_ENTITY_MIN_LENGTH; i < size; ++i) {
|
89
|
-
if (src[i] == ' ')
|
90
|
-
break;
|
91
|
-
|
92
|
-
if (src[i] == ';') {
|
93
|
-
const unsigned char *entity = S_lookup_entity(src, i);
|
94
|
-
|
95
|
-
if (entity != NULL) {
|
96
|
-
cmark_strbuf_puts(ob, (const char *)entity);
|
97
|
-
return i + 1;
|
98
|
-
}
|
99
|
-
|
100
|
-
break;
|
101
|
-
}
|
102
|
-
}
|
103
|
-
}
|
104
|
-
|
105
|
-
return 0;
|
106
|
-
}
|
107
|
-
|
108
|
-
int houdini_unescape_html(cmark_strbuf *ob, const uint8_t *src,
|
109
|
-
bufsize_t size) {
|
110
|
-
bufsize_t i = 0, org, ent;
|
111
|
-
|
112
|
-
while (i < size) {
|
113
|
-
org = i;
|
114
|
-
while (i < size && src[i] != '&')
|
115
|
-
i++;
|
116
|
-
|
117
|
-
if (likely(i > org)) {
|
118
|
-
if (unlikely(org == 0)) {
|
119
|
-
if (i >= size)
|
120
|
-
return 0;
|
121
|
-
|
122
|
-
cmark_strbuf_grow(ob, HOUDINI_UNESCAPED_SIZE(size));
|
123
|
-
}
|
124
|
-
|
125
|
-
cmark_strbuf_put(ob, src + org, i - org);
|
126
|
-
}
|
127
|
-
|
128
|
-
/* escaping */
|
129
|
-
if (i >= size)
|
130
|
-
break;
|
131
|
-
|
132
|
-
i++;
|
133
|
-
|
134
|
-
ent = houdini_unescape_ent(ob, src + i, size - i);
|
135
|
-
i += ent;
|
136
|
-
|
137
|
-
/* not really an entity */
|
138
|
-
if (ent == 0)
|
139
|
-
cmark_strbuf_putc(ob, '&');
|
140
|
-
}
|
141
|
-
|
142
|
-
return 1;
|
143
|
-
}
|
144
|
-
|
145
|
-
void houdini_unescape_html_f(cmark_strbuf *ob, const uint8_t *src,
|
146
|
-
bufsize_t size) {
|
147
|
-
if (!houdini_unescape_html(ob, src, size))
|
148
|
-
cmark_strbuf_put(ob, src, size);
|
149
|
-
}
|
@@ -1,457 +0,0 @@
|
|
1
|
-
#include <stdlib.h>
|
2
|
-
#include <stdio.h>
|
3
|
-
#include <string.h>
|
4
|
-
#include <assert.h>
|
5
|
-
#include "cmark_ctype.h"
|
6
|
-
#include "config.h"
|
7
|
-
#include "cmark.h"
|
8
|
-
#include "houdini.h"
|
9
|
-
#include "scanners.h"
|
10
|
-
#include "syntax_extension.h"
|
11
|
-
#include "html.h"
|
12
|
-
#include "render.h"
|
13
|
-
|
14
|
-
// Functions to convert cmark_nodes to HTML strings.
|
15
|
-
|
16
|
-
static void escape_html(cmark_strbuf *dest, const unsigned char *source,
|
17
|
-
bufsize_t length) {
|
18
|
-
houdini_escape_html0(dest, source, length, 0);
|
19
|
-
}
|
20
|
-
|
21
|
-
static void filter_html_block(cmark_html_renderer *renderer, uint8_t *data, size_t len) {
|
22
|
-
cmark_strbuf *html = renderer->html;
|
23
|
-
cmark_llist *it;
|
24
|
-
cmark_syntax_extension *ext;
|
25
|
-
bool filtered;
|
26
|
-
uint8_t *match;
|
27
|
-
|
28
|
-
while (len) {
|
29
|
-
match = (uint8_t *) memchr(data, '<', len);
|
30
|
-
if (!match)
|
31
|
-
break;
|
32
|
-
|
33
|
-
if (match != data) {
|
34
|
-
cmark_strbuf_put(html, data, (bufsize_t)(match - data));
|
35
|
-
len -= (match - data);
|
36
|
-
data = match;
|
37
|
-
}
|
38
|
-
|
39
|
-
filtered = false;
|
40
|
-
for (it = renderer->filter_extensions; it; it = it->next) {
|
41
|
-
ext = ((cmark_syntax_extension *) it->data);
|
42
|
-
if (!ext->html_filter_func(ext, data, len)) {
|
43
|
-
filtered = true;
|
44
|
-
break;
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
if (!filtered) {
|
49
|
-
cmark_strbuf_putc(html, '<');
|
50
|
-
} else {
|
51
|
-
cmark_strbuf_puts(html, "<");
|
52
|
-
}
|
53
|
-
|
54
|
-
++data;
|
55
|
-
--len;
|
56
|
-
}
|
57
|
-
|
58
|
-
if (len)
|
59
|
-
cmark_strbuf_put(html, data, (bufsize_t)len);
|
60
|
-
}
|
61
|
-
|
62
|
-
static bool S_put_footnote_backref(cmark_html_renderer *renderer, cmark_strbuf *html) {
|
63
|
-
if (renderer->written_footnote_ix >= renderer->footnote_ix)
|
64
|
-
return false;
|
65
|
-
renderer->written_footnote_ix = renderer->footnote_ix;
|
66
|
-
|
67
|
-
cmark_strbuf_puts(html, "<a href=\"#fnref");
|
68
|
-
char n[32];
|
69
|
-
snprintf(n, sizeof(n), "%d", renderer->footnote_ix);
|
70
|
-
cmark_strbuf_puts(html, n);
|
71
|
-
cmark_strbuf_puts(html, "\" class=\"footnote-backref\">↩</a>");
|
72
|
-
|
73
|
-
return true;
|
74
|
-
}
|
75
|
-
|
76
|
-
static int S_render_node(cmark_html_renderer *renderer, cmark_node *node,
|
77
|
-
cmark_event_type ev_type, int options) {
|
78
|
-
cmark_node *parent;
|
79
|
-
cmark_node *grandparent;
|
80
|
-
cmark_strbuf *html = renderer->html;
|
81
|
-
cmark_llist *it;
|
82
|
-
cmark_syntax_extension *ext;
|
83
|
-
char start_heading[] = "<h0";
|
84
|
-
char end_heading[] = "</h0";
|
85
|
-
bool tight;
|
86
|
-
bool filtered;
|
87
|
-
char buffer[BUFFER_SIZE];
|
88
|
-
|
89
|
-
bool entering = (ev_type == CMARK_EVENT_ENTER);
|
90
|
-
|
91
|
-
if (renderer->plain == node) { // back at original node
|
92
|
-
renderer->plain = NULL;
|
93
|
-
}
|
94
|
-
|
95
|
-
if (renderer->plain != NULL) {
|
96
|
-
switch (node->type) {
|
97
|
-
case CMARK_NODE_TEXT:
|
98
|
-
case CMARK_NODE_CODE:
|
99
|
-
case CMARK_NODE_HTML_INLINE:
|
100
|
-
escape_html(html, node->as.literal.data, node->as.literal.len);
|
101
|
-
break;
|
102
|
-
|
103
|
-
case CMARK_NODE_LINEBREAK:
|
104
|
-
case CMARK_NODE_SOFTBREAK:
|
105
|
-
cmark_strbuf_putc(html, ' ');
|
106
|
-
break;
|
107
|
-
|
108
|
-
default:
|
109
|
-
break;
|
110
|
-
}
|
111
|
-
return 1;
|
112
|
-
}
|
113
|
-
|
114
|
-
if (node->extension && node->extension->html_render_func) {
|
115
|
-
node->extension->html_render_func(node->extension, renderer, node, ev_type, options);
|
116
|
-
return 1;
|
117
|
-
}
|
118
|
-
|
119
|
-
switch (node->type) {
|
120
|
-
case CMARK_NODE_DOCUMENT:
|
121
|
-
break;
|
122
|
-
|
123
|
-
case CMARK_NODE_BLOCK_QUOTE:
|
124
|
-
if (entering) {
|
125
|
-
cmark_html_render_cr(html);
|
126
|
-
cmark_strbuf_puts(html, "<blockquote");
|
127
|
-
cmark_html_render_sourcepos(node, html, options);
|
128
|
-
cmark_strbuf_puts(html, ">\n");
|
129
|
-
} else {
|
130
|
-
cmark_html_render_cr(html);
|
131
|
-
cmark_strbuf_puts(html, "</blockquote>\n");
|
132
|
-
}
|
133
|
-
break;
|
134
|
-
|
135
|
-
case CMARK_NODE_LIST: {
|
136
|
-
cmark_list_type list_type = node->as.list.list_type;
|
137
|
-
int start = node->as.list.start;
|
138
|
-
|
139
|
-
if (entering) {
|
140
|
-
cmark_html_render_cr(html);
|
141
|
-
if (list_type == CMARK_BULLET_LIST) {
|
142
|
-
cmark_strbuf_puts(html, "<ul");
|
143
|
-
cmark_html_render_sourcepos(node, html, options);
|
144
|
-
cmark_strbuf_puts(html, ">\n");
|
145
|
-
} else if (start == 1) {
|
146
|
-
cmark_strbuf_puts(html, "<ol");
|
147
|
-
cmark_html_render_sourcepos(node, html, options);
|
148
|
-
cmark_strbuf_puts(html, ">\n");
|
149
|
-
} else {
|
150
|
-
snprintf(buffer, BUFFER_SIZE, "<ol start=\"%d\"", start);
|
151
|
-
cmark_strbuf_puts(html, buffer);
|
152
|
-
cmark_html_render_sourcepos(node, html, options);
|
153
|
-
cmark_strbuf_puts(html, ">\n");
|
154
|
-
}
|
155
|
-
} else {
|
156
|
-
cmark_strbuf_puts(html,
|
157
|
-
list_type == CMARK_BULLET_LIST ? "</ul>\n" : "</ol>\n");
|
158
|
-
}
|
159
|
-
break;
|
160
|
-
}
|
161
|
-
|
162
|
-
case CMARK_NODE_ITEM:
|
163
|
-
if (entering) {
|
164
|
-
cmark_html_render_cr(html);
|
165
|
-
cmark_strbuf_puts(html, "<li");
|
166
|
-
cmark_html_render_sourcepos(node, html, options);
|
167
|
-
cmark_strbuf_putc(html, '>');
|
168
|
-
} else {
|
169
|
-
cmark_strbuf_puts(html, "</li>\n");
|
170
|
-
}
|
171
|
-
break;
|
172
|
-
|
173
|
-
case CMARK_NODE_HEADING:
|
174
|
-
if (entering) {
|
175
|
-
cmark_html_render_cr(html);
|
176
|
-
start_heading[2] = (char)('0' + node->as.heading.level);
|
177
|
-
cmark_strbuf_puts(html, start_heading);
|
178
|
-
cmark_html_render_sourcepos(node, html, options);
|
179
|
-
cmark_strbuf_putc(html, '>');
|
180
|
-
} else {
|
181
|
-
end_heading[3] = (char)('0' + node->as.heading.level);
|
182
|
-
cmark_strbuf_puts(html, end_heading);
|
183
|
-
cmark_strbuf_puts(html, ">\n");
|
184
|
-
}
|
185
|
-
break;
|
186
|
-
|
187
|
-
case CMARK_NODE_CODE_BLOCK:
|
188
|
-
cmark_html_render_cr(html);
|
189
|
-
|
190
|
-
if (node->as.code.info.len == 0) {
|
191
|
-
cmark_strbuf_puts(html, "<pre");
|
192
|
-
cmark_html_render_sourcepos(node, html, options);
|
193
|
-
cmark_strbuf_puts(html, "><code>");
|
194
|
-
} else {
|
195
|
-
bufsize_t first_tag = 0;
|
196
|
-
while (first_tag < node->as.code.info.len &&
|
197
|
-
!cmark_isspace(node->as.code.info.data[first_tag])) {
|
198
|
-
first_tag += 1;
|
199
|
-
}
|
200
|
-
|
201
|
-
if (options & CMARK_OPT_GITHUB_PRE_LANG) {
|
202
|
-
cmark_strbuf_puts(html, "<pre");
|
203
|
-
cmark_html_render_sourcepos(node, html, options);
|
204
|
-
cmark_strbuf_puts(html, " lang=\"");
|
205
|
-
escape_html(html, node->as.code.info.data, first_tag);
|
206
|
-
cmark_strbuf_puts(html, "\"><code>");
|
207
|
-
} else {
|
208
|
-
cmark_strbuf_puts(html, "<pre");
|
209
|
-
cmark_html_render_sourcepos(node, html, options);
|
210
|
-
cmark_strbuf_puts(html, "><code class=\"language-");
|
211
|
-
escape_html(html, node->as.code.info.data, first_tag);
|
212
|
-
cmark_strbuf_puts(html, "\">");
|
213
|
-
}
|
214
|
-
}
|
215
|
-
|
216
|
-
escape_html(html, node->as.code.literal.data, node->as.code.literal.len);
|
217
|
-
cmark_strbuf_puts(html, "</code></pre>\n");
|
218
|
-
break;
|
219
|
-
|
220
|
-
case CMARK_NODE_HTML_BLOCK:
|
221
|
-
cmark_html_render_cr(html);
|
222
|
-
if (options & CMARK_OPT_SAFE) {
|
223
|
-
cmark_strbuf_puts(html, "<!-- raw HTML omitted -->");
|
224
|
-
} else if (renderer->filter_extensions) {
|
225
|
-
filter_html_block(renderer, node->as.literal.data, node->as.literal.len);
|
226
|
-
} else {
|
227
|
-
cmark_strbuf_put(html, node->as.literal.data, node->as.literal.len);
|
228
|
-
}
|
229
|
-
cmark_html_render_cr(html);
|
230
|
-
break;
|
231
|
-
|
232
|
-
case CMARK_NODE_CUSTOM_BLOCK:
|
233
|
-
cmark_html_render_cr(html);
|
234
|
-
if (entering) {
|
235
|
-
cmark_strbuf_put(html, node->as.custom.on_enter.data,
|
236
|
-
node->as.custom.on_enter.len);
|
237
|
-
} else {
|
238
|
-
cmark_strbuf_put(html, node->as.custom.on_exit.data,
|
239
|
-
node->as.custom.on_exit.len);
|
240
|
-
}
|
241
|
-
cmark_html_render_cr(html);
|
242
|
-
break;
|
243
|
-
|
244
|
-
case CMARK_NODE_THEMATIC_BREAK:
|
245
|
-
cmark_html_render_cr(html);
|
246
|
-
cmark_strbuf_puts(html, "<hr");
|
247
|
-
cmark_html_render_sourcepos(node, html, options);
|
248
|
-
cmark_strbuf_puts(html, " />\n");
|
249
|
-
break;
|
250
|
-
|
251
|
-
case CMARK_NODE_PARAGRAPH:
|
252
|
-
parent = cmark_node_parent(node);
|
253
|
-
grandparent = cmark_node_parent(parent);
|
254
|
-
if (grandparent != NULL && grandparent->type == CMARK_NODE_LIST) {
|
255
|
-
tight = grandparent->as.list.tight;
|
256
|
-
} else {
|
257
|
-
tight = false;
|
258
|
-
}
|
259
|
-
if (!tight) {
|
260
|
-
if (entering) {
|
261
|
-
cmark_html_render_cr(html);
|
262
|
-
cmark_strbuf_puts(html, "<p");
|
263
|
-
cmark_html_render_sourcepos(node, html, options);
|
264
|
-
cmark_strbuf_putc(html, '>');
|
265
|
-
} else {
|
266
|
-
if (parent->type == CMARK_NODE_FOOTNOTE_DEFINITION && node->next == NULL) {
|
267
|
-
cmark_strbuf_putc(html, ' ');
|
268
|
-
S_put_footnote_backref(renderer, html);
|
269
|
-
}
|
270
|
-
cmark_strbuf_puts(html, "</p>\n");
|
271
|
-
}
|
272
|
-
}
|
273
|
-
break;
|
274
|
-
|
275
|
-
case CMARK_NODE_TEXT:
|
276
|
-
escape_html(html, node->as.literal.data, node->as.literal.len);
|
277
|
-
break;
|
278
|
-
|
279
|
-
case CMARK_NODE_LINEBREAK:
|
280
|
-
cmark_strbuf_puts(html, "<br />\n");
|
281
|
-
break;
|
282
|
-
|
283
|
-
case CMARK_NODE_SOFTBREAK:
|
284
|
-
if (options & CMARK_OPT_HARDBREAKS) {
|
285
|
-
cmark_strbuf_puts(html, "<br />\n");
|
286
|
-
} else if (options & CMARK_OPT_NOBREAKS) {
|
287
|
-
cmark_strbuf_putc(html, ' ');
|
288
|
-
} else {
|
289
|
-
cmark_strbuf_putc(html, '\n');
|
290
|
-
}
|
291
|
-
break;
|
292
|
-
|
293
|
-
case CMARK_NODE_CODE:
|
294
|
-
cmark_strbuf_puts(html, "<code>");
|
295
|
-
escape_html(html, node->as.literal.data, node->as.literal.len);
|
296
|
-
cmark_strbuf_puts(html, "</code>");
|
297
|
-
break;
|
298
|
-
|
299
|
-
case CMARK_NODE_HTML_INLINE:
|
300
|
-
if (options & CMARK_OPT_SAFE) {
|
301
|
-
cmark_strbuf_puts(html, "<!-- raw HTML omitted -->");
|
302
|
-
} else {
|
303
|
-
filtered = false;
|
304
|
-
for (it = renderer->filter_extensions; it; it = it->next) {
|
305
|
-
ext = (cmark_syntax_extension *) it->data;
|
306
|
-
if (!ext->html_filter_func(ext, node->as.literal.data, node->as.literal.len)) {
|
307
|
-
filtered = true;
|
308
|
-
break;
|
309
|
-
}
|
310
|
-
}
|
311
|
-
if (!filtered) {
|
312
|
-
cmark_strbuf_put(html, node->as.literal.data, node->as.literal.len);
|
313
|
-
} else {
|
314
|
-
cmark_strbuf_puts(html, "<");
|
315
|
-
cmark_strbuf_put(html, node->as.literal.data + 1, node->as.literal.len - 1);
|
316
|
-
}
|
317
|
-
}
|
318
|
-
break;
|
319
|
-
|
320
|
-
case CMARK_NODE_CUSTOM_INLINE:
|
321
|
-
if (entering) {
|
322
|
-
cmark_strbuf_put(html, node->as.custom.on_enter.data,
|
323
|
-
node->as.custom.on_enter.len);
|
324
|
-
} else {
|
325
|
-
cmark_strbuf_put(html, node->as.custom.on_exit.data,
|
326
|
-
node->as.custom.on_exit.len);
|
327
|
-
}
|
328
|
-
break;
|
329
|
-
|
330
|
-
case CMARK_NODE_STRONG:
|
331
|
-
if (entering) {
|
332
|
-
cmark_strbuf_puts(html, "<strong>");
|
333
|
-
} else {
|
334
|
-
cmark_strbuf_puts(html, "</strong>");
|
335
|
-
}
|
336
|
-
break;
|
337
|
-
|
338
|
-
case CMARK_NODE_EMPH:
|
339
|
-
if (entering) {
|
340
|
-
cmark_strbuf_puts(html, "<em>");
|
341
|
-
} else {
|
342
|
-
cmark_strbuf_puts(html, "</em>");
|
343
|
-
}
|
344
|
-
break;
|
345
|
-
|
346
|
-
case CMARK_NODE_LINK:
|
347
|
-
if (entering) {
|
348
|
-
cmark_strbuf_puts(html, "<a href=\"");
|
349
|
-
if (!((options & CMARK_OPT_SAFE) &&
|
350
|
-
scan_dangerous_url(&node->as.link.url, 0))) {
|
351
|
-
houdini_escape_href(html, node->as.link.url.data,
|
352
|
-
node->as.link.url.len);
|
353
|
-
}
|
354
|
-
if (node->as.link.title.len) {
|
355
|
-
cmark_strbuf_puts(html, "\" title=\"");
|
356
|
-
escape_html(html, node->as.link.title.data, node->as.link.title.len);
|
357
|
-
}
|
358
|
-
cmark_strbuf_puts(html, "\">");
|
359
|
-
} else {
|
360
|
-
cmark_strbuf_puts(html, "</a>");
|
361
|
-
}
|
362
|
-
break;
|
363
|
-
|
364
|
-
case CMARK_NODE_IMAGE:
|
365
|
-
if (entering) {
|
366
|
-
cmark_strbuf_puts(html, "<img src=\"");
|
367
|
-
if (!((options & CMARK_OPT_SAFE) &&
|
368
|
-
scan_dangerous_url(&node->as.link.url, 0))) {
|
369
|
-
houdini_escape_href(html, node->as.link.url.data,
|
370
|
-
node->as.link.url.len);
|
371
|
-
}
|
372
|
-
cmark_strbuf_puts(html, "\" alt=\"");
|
373
|
-
renderer->plain = node;
|
374
|
-
} else {
|
375
|
-
if (node->as.link.title.len) {
|
376
|
-
cmark_strbuf_puts(html, "\" title=\"");
|
377
|
-
escape_html(html, node->as.link.title.data, node->as.link.title.len);
|
378
|
-
}
|
379
|
-
|
380
|
-
cmark_strbuf_puts(html, "\" />");
|
381
|
-
}
|
382
|
-
break;
|
383
|
-
|
384
|
-
case CMARK_NODE_FOOTNOTE_DEFINITION:
|
385
|
-
if (entering) {
|
386
|
-
if (renderer->footnote_ix == 0) {
|
387
|
-
cmark_strbuf_puts(html, "<section class=\"footnotes\">\n<ol>\n");
|
388
|
-
}
|
389
|
-
++renderer->footnote_ix;
|
390
|
-
cmark_strbuf_puts(html, "<li id=\"fn");
|
391
|
-
char n[32];
|
392
|
-
snprintf(n, sizeof(n), "%d", renderer->footnote_ix);
|
393
|
-
cmark_strbuf_puts(html, n);
|
394
|
-
cmark_strbuf_puts(html, "\">\n");
|
395
|
-
} else {
|
396
|
-
if (S_put_footnote_backref(renderer, html)) {
|
397
|
-
cmark_strbuf_putc(html, '\n');
|
398
|
-
}
|
399
|
-
cmark_strbuf_puts(html, "</li>\n");
|
400
|
-
}
|
401
|
-
break;
|
402
|
-
|
403
|
-
case CMARK_NODE_FOOTNOTE_REFERENCE:
|
404
|
-
if (entering) {
|
405
|
-
cmark_strbuf_puts(html, "<sup class=\"footnote-ref\"><a href=\"#fn");
|
406
|
-
cmark_strbuf_put(html, node->as.literal.data, node->as.literal.len);
|
407
|
-
cmark_strbuf_puts(html, "\" id=\"fnref");
|
408
|
-
cmark_strbuf_put(html, node->as.literal.data, node->as.literal.len);
|
409
|
-
cmark_strbuf_puts(html, "\">[");
|
410
|
-
cmark_strbuf_put(html, node->as.literal.data, node->as.literal.len);
|
411
|
-
cmark_strbuf_puts(html, "]</a></sup>");
|
412
|
-
}
|
413
|
-
break;
|
414
|
-
|
415
|
-
default:
|
416
|
-
assert(false);
|
417
|
-
break;
|
418
|
-
}
|
419
|
-
|
420
|
-
return 1;
|
421
|
-
}
|
422
|
-
|
423
|
-
char *cmark_render_html(cmark_node *root, int options, cmark_llist *extensions) {
|
424
|
-
return cmark_render_html_with_mem(root, options, extensions, cmark_node_mem(root));
|
425
|
-
}
|
426
|
-
|
427
|
-
char *cmark_render_html_with_mem(cmark_node *root, int options, cmark_llist *extensions, cmark_mem *mem) {
|
428
|
-
char *result;
|
429
|
-
cmark_strbuf html = CMARK_BUF_INIT(mem);
|
430
|
-
cmark_event_type ev_type;
|
431
|
-
cmark_node *cur;
|
432
|
-
cmark_html_renderer renderer = {&html, NULL, NULL, 0, 0, NULL};
|
433
|
-
cmark_iter *iter = cmark_iter_new(root);
|
434
|
-
|
435
|
-
for (; extensions; extensions = extensions->next)
|
436
|
-
if (((cmark_syntax_extension *) extensions->data)->html_filter_func)
|
437
|
-
renderer.filter_extensions = cmark_llist_append(
|
438
|
-
mem,
|
439
|
-
renderer.filter_extensions,
|
440
|
-
(cmark_syntax_extension *) extensions->data);
|
441
|
-
|
442
|
-
while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) {
|
443
|
-
cur = cmark_iter_get_node(iter);
|
444
|
-
S_render_node(&renderer, cur, ev_type, options);
|
445
|
-
}
|
446
|
-
|
447
|
-
if (renderer.footnote_ix) {
|
448
|
-
cmark_strbuf_puts(&html, "</ol>\n</section>\n");
|
449
|
-
}
|
450
|
-
|
451
|
-
result = (char *)cmark_strbuf_detach(&html);
|
452
|
-
|
453
|
-
cmark_llist_free(mem, renderer.filter_extensions);
|
454
|
-
|
455
|
-
cmark_iter_free(iter);
|
456
|
-
return result;
|
457
|
-
}
|