commonmarker 0.10.0 → 0.11.0
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 +3 -0
- data/bin/commonmarker +19 -3
- data/ext/commonmarker/cmark/CMakeLists.txt +1 -0
- data/ext/commonmarker/cmark/COPYING +2 -24
- data/ext/commonmarker/cmark/Makefile +25 -5
- data/ext/commonmarker/cmark/README.md +1 -1
- data/ext/commonmarker/cmark/api_test/CMakeLists.txt +1 -1
- data/ext/commonmarker/cmark/api_test/main.c +25 -27
- data/ext/commonmarker/cmark/build/CMakeCache.txt +12 -9
- data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CMakeCCompiler.cmake +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CMakeCXXCompiler.cmake +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CMakeDetermineCompilerABI_C.bin +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CMakeDetermineCompilerABI_CXX.bin +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CMakeSystem.cmake +4 -4
- data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CompilerIdC/CMakeCCompilerId.c +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CompilerIdC/a.out +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CompilerIdCXX/CMakeCXXCompilerId.cpp +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CompilerIdCXX/a.out +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/CMakeError.log +6 -6
- data/ext/commonmarker/cmark/build/CMakeFiles/CMakeOutput.log +148 -148
- data/ext/commonmarker/cmark/build/CMakeFiles/Makefile.cmake +41 -109
- data/ext/commonmarker/cmark/build/CMakeFiles/Makefile2 +66 -10
- data/ext/commonmarker/cmark/build/CMakeFiles/TargetDirectories.txt +8 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/progress.marks +1 -1
- data/ext/commonmarker/cmark/build/CTestTestfile.cmake +1 -0
- data/ext/commonmarker/cmark/build/Makefile +23 -9
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/build.make +2 -2
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/progress.marks +1 -1
- data/ext/commonmarker/cmark/build/api_test/Makefile +9 -9
- data/ext/commonmarker/cmark/build/cmake_install.cmake +1 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/C.includecache +190 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/DependInfo.cmake +29 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/autolink.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/build.make +249 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/cmake_clean.cmake +15 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/cmake_clean_target.cmake +3 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/core-extensions.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/depend.internal +92 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/depend.make +92 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/ext_scanners.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/flags.make +10 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/link.txt +2 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/progress.make +8 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/strikethrough.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/table.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/whitelist.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/extensions/Makefile +390 -0
- data/ext/commonmarker/cmark/build/extensions/cmake_install.cmake +29 -0
- data/ext/commonmarker/cmark/build/extensions/libcmarkextensions.a +0 -0
- data/ext/commonmarker/cmark/build/man/Makefile +9 -9
- data/ext/commonmarker/cmark/build/src/CMakeFiles/Export/lib/cmake/cmark.cmake +1 -1
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/DependInfo.cmake +7 -19
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/build.make +6 -517
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/cmake_clean.cmake +0 -19
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/flags.make +1 -1
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/link.txt +1 -1
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/progress.make +0 -19
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/DependInfo.cmake +9 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/build.make +112 -4
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/cmake_clean.cmake +4 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/flags.make +1 -1
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/link.txt +1 -1
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/progress.make +24 -20
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/C.includecache +144 -10
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/DependInfo.cmake +9 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/blocks.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/build.make +112 -4
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmake_clean.cmake +4 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmark.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/commonmark.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/depend.internal +74 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/depend.make +74 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/flags.make +1 -1
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/html.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/inlines.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/iterator.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/latex.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/link.txt +1 -1
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/linked_list.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/man.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/node.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/plugin.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/progress.make +24 -20
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/registry.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/scanners.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/syntax_extension.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/xml.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/progress.marks +1 -1
- data/ext/commonmarker/cmark/build/src/Makefile +141 -66
- data/ext/commonmarker/cmark/build/src/cmake_install.cmake +4 -0
- data/ext/commonmarker/cmark/build/src/libcmark.a +0 -0
- data/ext/commonmarker/cmark/build/testdir/CTestTestfile.cmake +3 -1
- data/ext/commonmarker/cmark/build/testdir/Makefile +9 -9
- data/ext/commonmarker/cmark/extensions/CMakeLists.txt +82 -0
- data/ext/commonmarker/cmark/extensions/autolink.c +338 -0
- data/ext/commonmarker/cmark/extensions/autolink.h +8 -0
- data/ext/commonmarker/cmark/extensions/core-extensions.c +16 -0
- data/ext/commonmarker/cmark/extensions/core-extensions.h +16 -0
- data/ext/commonmarker/cmark/extensions/ext_scanners.c +585 -0
- data/ext/commonmarker/cmark/extensions/ext_scanners.h +20 -0
- data/ext/commonmarker/cmark/extensions/ext_scanners.re +65 -0
- data/ext/commonmarker/cmark/extensions/strikethrough.c +142 -0
- data/ext/commonmarker/cmark/extensions/strikethrough.h +9 -0
- data/ext/commonmarker/cmark/extensions/table.c +493 -0
- data/ext/commonmarker/cmark/extensions/table.h +8 -0
- data/ext/commonmarker/cmark/extensions/whitelist.c +59 -0
- data/ext/commonmarker/cmark/extensions/whitelist.h +8 -0
- data/ext/commonmarker/cmark/man/man3/cmark.3 +98 -34
- data/ext/commonmarker/cmark/src/CMakeLists.txt +16 -1
- data/ext/commonmarker/cmark/src/blocks.c +219 -40
- data/ext/commonmarker/cmark/src/buffer.h +36 -0
- data/ext/commonmarker/cmark/src/cmark.c +5 -1
- data/ext/commonmarker/cmark/src/cmark.h +91 -34
- data/ext/commonmarker/cmark/src/cmark_ctype.h +7 -0
- data/ext/commonmarker/cmark/src/cmark_extension_api.h +655 -0
- data/ext/commonmarker/cmark/src/commonmark.c +7 -2
- data/ext/commonmarker/cmark/src/houdini.h +12 -6
- data/ext/commonmarker/cmark/src/houdini_html_e.c +1 -1
- data/ext/commonmarker/cmark/src/html.c +102 -54
- data/ext/commonmarker/cmark/src/html.h +27 -0
- data/ext/commonmarker/cmark/src/inlines.c +261 -53
- data/ext/commonmarker/cmark/src/inlines.h +7 -2
- data/ext/commonmarker/cmark/src/iterator.c +12 -7
- data/ext/commonmarker/cmark/src/latex.c +5 -2
- data/ext/commonmarker/cmark/src/linked_list.c +37 -0
- data/ext/commonmarker/cmark/src/main.c +91 -27
- data/ext/commonmarker/cmark/src/man.c +18 -2
- data/ext/commonmarker/cmark/src/node.c +157 -58
- data/ext/commonmarker/cmark/src/node.h +23 -0
- data/ext/commonmarker/cmark/src/parser.h +19 -2
- data/ext/commonmarker/cmark/src/plugin.c +33 -0
- data/ext/commonmarker/cmark/src/plugin.h +34 -0
- data/ext/commonmarker/cmark/src/registry.c +60 -0
- data/ext/commonmarker/cmark/src/registry.h +24 -0
- data/ext/commonmarker/cmark/src/render.h +9 -0
- data/ext/commonmarker/cmark/src/scanners.c +265 -391
- data/ext/commonmarker/cmark/src/scanners.h +5 -0
- data/ext/commonmarker/cmark/src/scanners.re +2 -2
- data/ext/commonmarker/cmark/src/syntax_extension.c +110 -0
- data/ext/commonmarker/cmark/src/syntax_extension.h +27 -0
- data/ext/commonmarker/cmark/suppressions +28 -0
- data/ext/commonmarker/cmark/test/CMakeLists.txt +12 -1
- data/ext/commonmarker/cmark/test/extensions.txt +173 -0
- data/ext/commonmarker/cmark/test/regression.txt +24 -0
- data/ext/commonmarker/cmark/test/spec.txt +27 -26
- data/ext/commonmarker/cmark/toolchain-mingw32.cmake +1 -1
- data/ext/commonmarker/commonmarker.c +132 -15
- data/ext/commonmarker/commonmarker.h +4 -0
- data/ext/commonmarker/extconf.rb +12 -5
- data/lib/commonmarker.rb +8 -6
- data/lib/commonmarker/node.rb +13 -2
- data/lib/commonmarker/renderer.rb +1 -1
- data/lib/commonmarker/version.rb +1 -1
- data/test/test_commonmark.rb +34 -0
- data/test/test_encoding.rb +2 -1
- data/test/test_extensions.rb +50 -0
- data/test/test_helper.rb +2 -1
- metadata +65 -11
@@ -35,6 +35,9 @@ if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMP
|
|
35
35
|
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/src/cmark")
|
36
36
|
if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/cmark" AND
|
37
37
|
NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/cmark")
|
38
|
+
execute_process(COMMAND /usr/bin/install_name_tool
|
39
|
+
-delete_rpath "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/src"
|
40
|
+
"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/cmark")
|
38
41
|
if(CMAKE_INSTALL_DO_STRIP)
|
39
42
|
execute_process(COMMAND "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/cmark")
|
40
43
|
endif()
|
@@ -70,6 +73,7 @@ endif()
|
|
70
73
|
if("${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT)
|
71
74
|
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/include" TYPE FILE FILES
|
72
75
|
"/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/src/cmark.h"
|
76
|
+
"/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/src/cmark_extension_api.h"
|
73
77
|
"/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/src/cmark_export.h"
|
74
78
|
"/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/src/cmark_version.h"
|
75
79
|
)
|
Binary file
|
@@ -10,5 +10,7 @@ add_test(spectest_library "/usr/local/bin/python3" "/Users/gjtorikian/Developmen
|
|
10
10
|
add_test(pathological_tests_library "/usr/local/bin/python3" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/test/pathological_tests.py" "--library-dir" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/testdir/../src")
|
11
11
|
add_test(spectest_executable "/usr/local/bin/python3" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/test/spec_tests.py" "--no-normalize" "--spec" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/test/spec.txt" "--program" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/testdir/../src/cmark")
|
12
12
|
add_test(smartpuncttest_executable "/usr/local/bin/python3" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/test/spec_tests.py" "--no-normalize" "--spec" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/test/smart_punct.txt" "--program" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/testdir/../src/cmark --smart")
|
13
|
-
add_test(
|
13
|
+
add_test(extensions_executable "/usr/local/bin/python3" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/test/spec_tests.py" "--no-normalize" "--spec" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/test/extensions.txt" "--program" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/testdir/../src/cmark -e table -e strikethrough -e whitelist -e autolink")
|
14
|
+
add_test(roundtriptest_library "/usr/local/bin/python3" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/test/roundtrip_tests.py" "--spec" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/test/spec.txt" "--library-dir" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/testdir/../src")
|
15
|
+
add_test(roundtrip_extensions_executable "/usr/local/bin/python3" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/test/roundtrip_tests.py" "--spec" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/test/extensions.txt" "--program" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/testdir/../src/cmark -e table -e strikethrough -e whitelist -e autolink")
|
14
16
|
add_test(regressiontest_executable "/usr/local/bin/python3" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/test/spec_tests.py" "--no-normalize" "--spec" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/test/regression.txt" "--program" "/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/testdir/../src/cmark")
|
@@ -39,10 +39,10 @@ cmake_force:
|
|
39
39
|
SHELL = /bin/sh
|
40
40
|
|
41
41
|
# The CMake executable.
|
42
|
-
CMAKE_COMMAND = /usr/local/Cellar/cmake/3.6.
|
42
|
+
CMAKE_COMMAND = /usr/local/Cellar/cmake/3.6.1/bin/cmake
|
43
43
|
|
44
44
|
# The command to remove a file.
|
45
|
-
RM = /usr/local/Cellar/cmake/3.6.
|
45
|
+
RM = /usr/local/Cellar/cmake/3.6.1/bin/cmake -E remove -f
|
46
46
|
|
47
47
|
# Escaping for special characters.
|
48
48
|
EQUALS = =
|
@@ -59,7 +59,7 @@ CMAKE_BINARY_DIR = /Users/gjtorikian/Development/commonmarker/ext/commonmarker/c
|
|
59
59
|
# Special rule for the target test
|
60
60
|
test:
|
61
61
|
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running tests..."
|
62
|
-
/usr/local/Cellar/cmake/3.6.
|
62
|
+
/usr/local/Cellar/cmake/3.6.1/bin/ctest --force-new-ctest-process $(ARGS)
|
63
63
|
.PHONY : test
|
64
64
|
|
65
65
|
# Special rule for the target test
|
@@ -70,7 +70,7 @@ test/fast: test
|
|
70
70
|
# Special rule for the target install/local
|
71
71
|
install/local: preinstall
|
72
72
|
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
|
73
|
-
/usr/local/Cellar/cmake/3.6.
|
73
|
+
/usr/local/Cellar/cmake/3.6.1/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
|
74
74
|
.PHONY : install/local
|
75
75
|
|
76
76
|
# Special rule for the target install/local
|
@@ -81,7 +81,7 @@ install/local/fast: install/local
|
|
81
81
|
# Special rule for the target edit_cache
|
82
82
|
edit_cache:
|
83
83
|
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
|
84
|
-
/usr/local/Cellar/cmake/3.6.
|
84
|
+
/usr/local/Cellar/cmake/3.6.1/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
|
85
85
|
.PHONY : edit_cache
|
86
86
|
|
87
87
|
# Special rule for the target edit_cache
|
@@ -92,7 +92,7 @@ edit_cache/fast: edit_cache
|
|
92
92
|
# Special rule for the target rebuild_cache
|
93
93
|
rebuild_cache:
|
94
94
|
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
|
95
|
-
/usr/local/Cellar/cmake/3.6.
|
95
|
+
/usr/local/Cellar/cmake/3.6.1/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
|
96
96
|
.PHONY : rebuild_cache
|
97
97
|
|
98
98
|
# Special rule for the target rebuild_cache
|
@@ -113,19 +113,19 @@ list_install_components/fast: list_install_components
|
|
113
113
|
# Special rule for the target install
|
114
114
|
install: preinstall
|
115
115
|
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
|
116
|
-
/usr/local/Cellar/cmake/3.6.
|
116
|
+
/usr/local/Cellar/cmake/3.6.1/bin/cmake -P cmake_install.cmake
|
117
117
|
.PHONY : install
|
118
118
|
|
119
119
|
# Special rule for the target install
|
120
120
|
install/fast: preinstall/fast
|
121
121
|
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
|
122
|
-
/usr/local/Cellar/cmake/3.6.
|
122
|
+
/usr/local/Cellar/cmake/3.6.1/bin/cmake -P cmake_install.cmake
|
123
123
|
.PHONY : install/fast
|
124
124
|
|
125
125
|
# Special rule for the target install/strip
|
126
126
|
install/strip: preinstall
|
127
127
|
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
|
128
|
-
/usr/local/Cellar/cmake/3.6.
|
128
|
+
/usr/local/Cellar/cmake/3.6.1/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
|
129
129
|
.PHONY : install/strip
|
130
130
|
|
131
131
|
# Special rule for the target install/strip
|
@@ -0,0 +1,82 @@
|
|
1
|
+
cmake_minimum_required(VERSION 2.8)
|
2
|
+
set(STATICLIBRARY "libcmarkextensions_static")
|
3
|
+
set(LIBRARY_SOURCES
|
4
|
+
core-extensions.c
|
5
|
+
table.c
|
6
|
+
strikethrough.c
|
7
|
+
whitelist.c
|
8
|
+
autolink.c
|
9
|
+
ext_scanners.c
|
10
|
+
ext_scanners.h
|
11
|
+
)
|
12
|
+
|
13
|
+
include_directories(
|
14
|
+
${PROJECT_SOURCE_DIR}/src
|
15
|
+
${PROJECT_BINARY_DIR}/src
|
16
|
+
)
|
17
|
+
|
18
|
+
# We make LIB_INSTALL_DIR configurable rather than
|
19
|
+
# hard-coding lib, because on some OSes different locations
|
20
|
+
# are used for different architectures (e.g. /usr/lib64 on
|
21
|
+
# 64-bit Fedora).
|
22
|
+
if(NOT LIB_INSTALL_DIR)
|
23
|
+
set(LIB_INSTALL_DIR "lib" CACHE STRING
|
24
|
+
"Set the installation directory for libraries." FORCE)
|
25
|
+
endif(NOT LIB_INSTALL_DIR)
|
26
|
+
|
27
|
+
include_directories(. ${CMAKE_CURRENT_BINARY_DIR})
|
28
|
+
|
29
|
+
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE} -pg")
|
30
|
+
set(CMAKE_LINKER_PROFILE "${CMAKE_LINKER_FLAGS_RELEASE} -pg")
|
31
|
+
|
32
|
+
add_library(${STATICLIBRARY} STATIC ${LIBRARY_SOURCES})
|
33
|
+
|
34
|
+
set_target_properties(${STATICLIBRARY} PROPERTIES
|
35
|
+
COMPILE_FLAGS -DCMARK_STATIC_DEFINE
|
36
|
+
POSITION_INDEPENDENT_CODE ON)
|
37
|
+
|
38
|
+
if (MSVC)
|
39
|
+
set_target_properties(${STATICLIBRARY} PROPERTIES
|
40
|
+
OUTPUT_NAME "cmarkextensions_static"
|
41
|
+
VERSION ${PROJECT_VERSION})
|
42
|
+
else()
|
43
|
+
set_target_properties(${STATICLIBRARY} PROPERTIES
|
44
|
+
OUTPUT_NAME "cmarkextensions"
|
45
|
+
VERSION ${PROJECT_VERSION})
|
46
|
+
endif(MSVC)
|
47
|
+
|
48
|
+
# Feature tests
|
49
|
+
include(CheckIncludeFile)
|
50
|
+
include(CheckCSourceCompiles)
|
51
|
+
include(CheckCSourceRuns)
|
52
|
+
include(CheckSymbolExists)
|
53
|
+
CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
|
54
|
+
CHECK_C_SOURCE_COMPILES(
|
55
|
+
"int main() { __builtin_expect(0,0); return 0; }"
|
56
|
+
HAVE___BUILTIN_EXPECT)
|
57
|
+
CHECK_C_SOURCE_COMPILES("
|
58
|
+
int f(void) __attribute__ (());
|
59
|
+
int main() { return 0; }
|
60
|
+
" HAVE___ATTRIBUTE__)
|
61
|
+
|
62
|
+
# Always compile with warnings
|
63
|
+
if(MSVC)
|
64
|
+
# Force to always compile with W4
|
65
|
+
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
66
|
+
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
67
|
+
else()
|
68
|
+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
|
69
|
+
endif()
|
70
|
+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4706 /D_CRT_SECURE_NO_WARNINGS")
|
71
|
+
elseif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
72
|
+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99 -pedantic")
|
73
|
+
endif()
|
74
|
+
|
75
|
+
# Compile as C++ under MSVC older than 12.0
|
76
|
+
if(MSVC AND MSVC_VERSION LESS 1800)
|
77
|
+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /TP")
|
78
|
+
endif()
|
79
|
+
|
80
|
+
if(CMAKE_BUILD_TYPE STREQUAL "Ubsan")
|
81
|
+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined")
|
82
|
+
endif()
|
@@ -0,0 +1,338 @@
|
|
1
|
+
#include "autolink.h"
|
2
|
+
#include <parser.h>
|
3
|
+
#include <string.h>
|
4
|
+
|
5
|
+
#if defined(_WIN32)
|
6
|
+
#define strncasecmp _strnicmp
|
7
|
+
#endif
|
8
|
+
|
9
|
+
static int sd_autolink_issafe(const uint8_t *link, size_t link_len) {
|
10
|
+
static const size_t valid_uris_count = 5;
|
11
|
+
static const char *valid_uris[] = {
|
12
|
+
"/", "http://", "https://", "ftp://", "mailto:"
|
13
|
+
};
|
14
|
+
|
15
|
+
size_t i;
|
16
|
+
|
17
|
+
for (i = 0; i < valid_uris_count; ++i) {
|
18
|
+
size_t len = strlen(valid_uris[i]);
|
19
|
+
|
20
|
+
if (link_len > len &&
|
21
|
+
strncasecmp((char *)link, valid_uris[i], len) == 0 &&
|
22
|
+
cmark_isalnum(link[len]))
|
23
|
+
return 1;
|
24
|
+
}
|
25
|
+
|
26
|
+
return 0;
|
27
|
+
}
|
28
|
+
|
29
|
+
static size_t
|
30
|
+
autolink_delim(uint8_t *data, size_t link_end, size_t max_rewind, size_t size)
|
31
|
+
{
|
32
|
+
uint8_t cclose, copen;
|
33
|
+
size_t i;
|
34
|
+
|
35
|
+
for (i = 0; i < link_end; ++i)
|
36
|
+
if (data[i] == '<') {
|
37
|
+
link_end = i;
|
38
|
+
break;
|
39
|
+
}
|
40
|
+
|
41
|
+
while (link_end > 0) {
|
42
|
+
if (strchr("?!.,:", data[link_end - 1]) != NULL)
|
43
|
+
link_end--;
|
44
|
+
|
45
|
+
else if (data[link_end - 1] == ';') {
|
46
|
+
size_t new_end = link_end - 2;
|
47
|
+
|
48
|
+
while (new_end > 0 && cmark_isalpha(data[new_end]))
|
49
|
+
new_end--;
|
50
|
+
|
51
|
+
if (new_end < link_end - 2 && data[new_end] == '&')
|
52
|
+
link_end = new_end;
|
53
|
+
else
|
54
|
+
link_end--;
|
55
|
+
}
|
56
|
+
else break;
|
57
|
+
}
|
58
|
+
|
59
|
+
while (link_end > 0) {
|
60
|
+
cclose = data[link_end - 1];
|
61
|
+
|
62
|
+
switch (cclose) {
|
63
|
+
case '"': copen = '"'; break;
|
64
|
+
case '\'': copen = '\''; break;
|
65
|
+
case ')': copen = '('; break;
|
66
|
+
case ']': copen = '['; break;
|
67
|
+
case '}': copen = '{'; break;
|
68
|
+
default: copen = 0;
|
69
|
+
}
|
70
|
+
|
71
|
+
if (copen == 0)
|
72
|
+
break;
|
73
|
+
|
74
|
+
size_t closing = 0;
|
75
|
+
size_t opening = 0;
|
76
|
+
size_t i = 0;
|
77
|
+
|
78
|
+
/* Try to close the final punctuation sign in this same line;
|
79
|
+
* if we managed to close it outside of the URL, that means that it's
|
80
|
+
* not part of the URL. If it closes inside the URL, that means it
|
81
|
+
* is part of the URL.
|
82
|
+
*
|
83
|
+
* Examples:
|
84
|
+
*
|
85
|
+
* foo http://www.pokemon.com/Pikachu_(Electric) bar
|
86
|
+
* => http://www.pokemon.com/Pikachu_(Electric)
|
87
|
+
*
|
88
|
+
* foo (http://www.pokemon.com/Pikachu_(Electric)) bar
|
89
|
+
* => http://www.pokemon.com/Pikachu_(Electric)
|
90
|
+
*
|
91
|
+
* foo http://www.pokemon.com/Pikachu_(Electric)) bar
|
92
|
+
* => http://www.pokemon.com/Pikachu_(Electric)
|
93
|
+
*
|
94
|
+
* (foo http://www.pokemon.com/Pikachu_(Electric)) bar
|
95
|
+
* => foo http://www.pokemon.com/Pikachu_(Electric)
|
96
|
+
*/
|
97
|
+
|
98
|
+
while (i < link_end) {
|
99
|
+
if (data[i] == copen)
|
100
|
+
opening++;
|
101
|
+
else if (data[i] == cclose)
|
102
|
+
closing++;
|
103
|
+
|
104
|
+
i++;
|
105
|
+
}
|
106
|
+
|
107
|
+
if (closing == opening)
|
108
|
+
break;
|
109
|
+
|
110
|
+
link_end--;
|
111
|
+
}
|
112
|
+
|
113
|
+
return link_end;
|
114
|
+
}
|
115
|
+
|
116
|
+
static size_t
|
117
|
+
check_domain(uint8_t *data, size_t size, int allow_short)
|
118
|
+
{
|
119
|
+
size_t i, np = 0, uscore1 = 0, uscore2 = 0;
|
120
|
+
|
121
|
+
for (i = 1; i < size - 1; i++) {
|
122
|
+
if (data[i] == '_') uscore2++;
|
123
|
+
else if (data[i] == '.') {
|
124
|
+
uscore1 = uscore2;
|
125
|
+
uscore2 = 0;
|
126
|
+
np++;
|
127
|
+
}
|
128
|
+
else if (!cmark_isalnum(data[i]) && data[i] != '-') break;
|
129
|
+
}
|
130
|
+
|
131
|
+
if (uscore1 > 0 || uscore2 > 0) return 0;
|
132
|
+
|
133
|
+
if (allow_short) {
|
134
|
+
/* We don't need a valid domain in the strict sense (with
|
135
|
+
* least one dot; so just make sure it's composed of valid
|
136
|
+
* domain characters and return the length of the the valid
|
137
|
+
* sequence. */
|
138
|
+
return i;
|
139
|
+
} else {
|
140
|
+
/* a valid domain needs to have at least a dot.
|
141
|
+
* that's as far as we get */
|
142
|
+
return np ? i : 0;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
static cmark_node *www_match(cmark_parser *parser, cmark_node *parent, cmark_inline_parser *inline_parser) {
|
147
|
+
cmark_chunk *chunk = cmark_inline_parser_get_chunk(inline_parser);
|
148
|
+
size_t max_rewind = cmark_inline_parser_get_offset(inline_parser);
|
149
|
+
uint8_t *data = chunk->data + max_rewind;
|
150
|
+
size_t size = chunk->len - max_rewind;
|
151
|
+
|
152
|
+
size_t link_end;
|
153
|
+
|
154
|
+
if (max_rewind > 0 && data[-1] != '(' && data[-1] != '[' && !cmark_isspace(data[-1]))
|
155
|
+
return 0;
|
156
|
+
|
157
|
+
if (size < 4 || memcmp(data, "www.", strlen("www.")) != 0)
|
158
|
+
return 0;
|
159
|
+
|
160
|
+
link_end = check_domain(data, size, 0);
|
161
|
+
|
162
|
+
if (link_end == 0)
|
163
|
+
return NULL;
|
164
|
+
|
165
|
+
while (link_end < size && !cmark_isspace(data[link_end]))
|
166
|
+
link_end++;
|
167
|
+
|
168
|
+
link_end = autolink_delim(data, link_end, max_rewind, size);
|
169
|
+
|
170
|
+
if (link_end == 0)
|
171
|
+
return NULL;
|
172
|
+
|
173
|
+
cmark_inline_parser_set_offset(inline_parser, max_rewind + link_end);
|
174
|
+
|
175
|
+
cmark_node *node = cmark_node_new_with_mem(CMARK_NODE_LINK, parser->mem);
|
176
|
+
|
177
|
+
cmark_strbuf buf;
|
178
|
+
cmark_strbuf_init(parser->mem, &buf, 10);
|
179
|
+
cmark_strbuf_puts(&buf, "http://");
|
180
|
+
cmark_strbuf_put(&buf, data, link_end);
|
181
|
+
node->as.link.url = cmark_chunk_buf_detach(&buf);
|
182
|
+
|
183
|
+
cmark_node *text = cmark_node_new_with_mem(CMARK_NODE_TEXT, parser->mem);
|
184
|
+
text->as.literal = cmark_chunk_dup(chunk, max_rewind, link_end);
|
185
|
+
cmark_node_append_child(node, text);
|
186
|
+
|
187
|
+
return node;
|
188
|
+
}
|
189
|
+
|
190
|
+
static cmark_node *email_match(cmark_parser *parser, cmark_node *parent, cmark_inline_parser *inline_parser) {
|
191
|
+
size_t link_end, rewind;
|
192
|
+
int nb = 0, np = 0, ns = 0;
|
193
|
+
|
194
|
+
cmark_chunk *chunk = cmark_inline_parser_get_chunk(inline_parser);
|
195
|
+
size_t max_rewind = cmark_inline_parser_get_offset(inline_parser);
|
196
|
+
uint8_t *data = chunk->data + max_rewind;
|
197
|
+
size_t size = chunk->len - max_rewind;
|
198
|
+
|
199
|
+
for (rewind = 0; rewind < max_rewind; ++rewind) {
|
200
|
+
uint8_t c = data[-rewind - 1];
|
201
|
+
|
202
|
+
if (cmark_isalnum(c))
|
203
|
+
continue;
|
204
|
+
|
205
|
+
if (strchr(".+-_", c) != NULL)
|
206
|
+
continue;
|
207
|
+
|
208
|
+
if (c == '/')
|
209
|
+
ns++;
|
210
|
+
|
211
|
+
break;
|
212
|
+
}
|
213
|
+
|
214
|
+
if (rewind == 0 || ns > 0)
|
215
|
+
return 0;
|
216
|
+
|
217
|
+
for (link_end = 0; link_end < size; ++link_end) {
|
218
|
+
uint8_t c = data[link_end];
|
219
|
+
|
220
|
+
if (cmark_isalnum(c))
|
221
|
+
continue;
|
222
|
+
|
223
|
+
if (c == '@')
|
224
|
+
nb++;
|
225
|
+
else if (c == '.' && link_end < size - 1)
|
226
|
+
np++;
|
227
|
+
else if (c != '-' && c != '_')
|
228
|
+
break;
|
229
|
+
}
|
230
|
+
|
231
|
+
if (link_end < 2 || nb != 1 || np == 0 ||
|
232
|
+
(!cmark_isalpha(data[link_end - 1]) && data[link_end - 1] != '.'))
|
233
|
+
return 0;
|
234
|
+
|
235
|
+
link_end = autolink_delim(data, link_end, max_rewind, size);
|
236
|
+
|
237
|
+
if (link_end == 0)
|
238
|
+
return NULL;
|
239
|
+
|
240
|
+
cmark_inline_parser_set_offset(inline_parser, max_rewind + link_end);
|
241
|
+
cmark_node_unput(parent, rewind);
|
242
|
+
|
243
|
+
cmark_node *node = cmark_node_new_with_mem(CMARK_NODE_LINK, parser->mem);
|
244
|
+
|
245
|
+
cmark_strbuf buf;
|
246
|
+
cmark_strbuf_init(parser->mem, &buf, 10);
|
247
|
+
cmark_strbuf_puts(&buf, "mailto:");
|
248
|
+
cmark_strbuf_put(&buf, data - rewind, link_end + rewind);
|
249
|
+
node->as.link.url = cmark_chunk_buf_detach(&buf);
|
250
|
+
|
251
|
+
cmark_node *text = cmark_node_new_with_mem(CMARK_NODE_TEXT, parser->mem);
|
252
|
+
text->as.literal = cmark_chunk_dup(chunk, max_rewind - rewind, link_end + rewind);
|
253
|
+
cmark_node_append_child(node, text);
|
254
|
+
|
255
|
+
return node;
|
256
|
+
}
|
257
|
+
|
258
|
+
static cmark_node *url_match(cmark_parser *parser, cmark_node *parent, cmark_inline_parser *inline_parser) {
|
259
|
+
size_t link_end, rewind = 0, domain_len;
|
260
|
+
|
261
|
+
cmark_chunk *chunk = cmark_inline_parser_get_chunk(inline_parser);
|
262
|
+
size_t max_rewind = cmark_inline_parser_get_offset(inline_parser);
|
263
|
+
uint8_t *data = chunk->data + max_rewind;
|
264
|
+
size_t size = chunk->len - max_rewind;
|
265
|
+
|
266
|
+
if (size < 4 || data[1] != '/' || data[2] != '/')
|
267
|
+
return 0;
|
268
|
+
|
269
|
+
while (rewind < max_rewind && cmark_isalpha(data[-rewind - 1]))
|
270
|
+
rewind++;
|
271
|
+
|
272
|
+
if (!sd_autolink_issafe(data - rewind, size + rewind))
|
273
|
+
return 0;
|
274
|
+
|
275
|
+
link_end = strlen("://");
|
276
|
+
|
277
|
+
domain_len = check_domain(data + link_end, size - link_end, 1);
|
278
|
+
|
279
|
+
if (domain_len == 0)
|
280
|
+
return 0;
|
281
|
+
|
282
|
+
link_end += domain_len;
|
283
|
+
while (link_end < size && !cmark_isspace(data[link_end]))
|
284
|
+
link_end++;
|
285
|
+
|
286
|
+
link_end = autolink_delim(data, link_end, max_rewind, size);
|
287
|
+
|
288
|
+
if (link_end == 0)
|
289
|
+
return NULL;
|
290
|
+
|
291
|
+
cmark_inline_parser_set_offset(inline_parser, max_rewind + link_end);
|
292
|
+
cmark_node_unput(parent, rewind);
|
293
|
+
|
294
|
+
cmark_node *node = cmark_node_new_with_mem(CMARK_NODE_LINK, parser->mem);
|
295
|
+
|
296
|
+
cmark_chunk url = cmark_chunk_dup(chunk, max_rewind - rewind, link_end + rewind);
|
297
|
+
node->as.link.url = url;
|
298
|
+
|
299
|
+
cmark_node *text = cmark_node_new_with_mem(CMARK_NODE_TEXT, parser->mem);
|
300
|
+
text->as.literal = url;
|
301
|
+
cmark_node_append_child(node, text);
|
302
|
+
|
303
|
+
return node;
|
304
|
+
}
|
305
|
+
|
306
|
+
static cmark_node *match(cmark_syntax_extension *ext, cmark_parser *parser, cmark_node *parent, unsigned char c, cmark_inline_parser *inline_parser) {
|
307
|
+
if (cmark_inline_parser_in_bracket(inline_parser, false))
|
308
|
+
return NULL;
|
309
|
+
|
310
|
+
if (c == ':')
|
311
|
+
return url_match(parser, parent, inline_parser);
|
312
|
+
|
313
|
+
if (c == '@')
|
314
|
+
return email_match(parser, parent, inline_parser);
|
315
|
+
|
316
|
+
if (c == 'w')
|
317
|
+
return www_match(parser, parent, inline_parser);
|
318
|
+
|
319
|
+
return NULL;
|
320
|
+
|
321
|
+
// note that we could end up re-consuming something already a
|
322
|
+
// part of an inline, because we don't track when the last
|
323
|
+
// inline was finished in inlines.c.
|
324
|
+
}
|
325
|
+
|
326
|
+
cmark_syntax_extension *create_autolink_extension(void) {
|
327
|
+
cmark_syntax_extension *ext = cmark_syntax_extension_new("autolink");
|
328
|
+
cmark_llist *special_chars = NULL;
|
329
|
+
|
330
|
+
cmark_syntax_extension_set_match_inline_func(ext, match);
|
331
|
+
|
332
|
+
special_chars = cmark_llist_append(special_chars, (void *) ':');
|
333
|
+
special_chars = cmark_llist_append(special_chars, (void *) '@');
|
334
|
+
special_chars = cmark_llist_append(special_chars, (void *) 'w');
|
335
|
+
cmark_syntax_extension_set_special_inline_chars(ext, special_chars);
|
336
|
+
|
337
|
+
return ext;
|
338
|
+
}
|