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.

Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -0
  3. data/bin/commonmarker +19 -3
  4. data/ext/commonmarker/cmark/CMakeLists.txt +1 -0
  5. data/ext/commonmarker/cmark/COPYING +2 -24
  6. data/ext/commonmarker/cmark/Makefile +25 -5
  7. data/ext/commonmarker/cmark/README.md +1 -1
  8. data/ext/commonmarker/cmark/api_test/CMakeLists.txt +1 -1
  9. data/ext/commonmarker/cmark/api_test/main.c +25 -27
  10. data/ext/commonmarker/cmark/build/CMakeCache.txt +12 -9
  11. data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CMakeCCompiler.cmake +0 -0
  12. data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CMakeCXXCompiler.cmake +0 -0
  13. data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CMakeDetermineCompilerABI_C.bin +0 -0
  14. data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CMakeDetermineCompilerABI_CXX.bin +0 -0
  15. data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CMakeSystem.cmake +4 -4
  16. data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CompilerIdC/CMakeCCompilerId.c +0 -0
  17. data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CompilerIdC/a.out +0 -0
  18. data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CompilerIdCXX/CMakeCXXCompilerId.cpp +0 -0
  19. data/ext/commonmarker/cmark/build/CMakeFiles/{3.6.0 → 3.6.1}/CompilerIdCXX/a.out +0 -0
  20. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeError.log +6 -6
  21. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeOutput.log +148 -148
  22. data/ext/commonmarker/cmark/build/CMakeFiles/Makefile.cmake +41 -109
  23. data/ext/commonmarker/cmark/build/CMakeFiles/Makefile2 +66 -10
  24. data/ext/commonmarker/cmark/build/CMakeFiles/TargetDirectories.txt +8 -0
  25. data/ext/commonmarker/cmark/build/CMakeFiles/progress.marks +1 -1
  26. data/ext/commonmarker/cmark/build/CTestTestfile.cmake +1 -0
  27. data/ext/commonmarker/cmark/build/Makefile +23 -9
  28. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/build.make +2 -2
  29. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/progress.marks +1 -1
  30. data/ext/commonmarker/cmark/build/api_test/Makefile +9 -9
  31. data/ext/commonmarker/cmark/build/cmake_install.cmake +1 -0
  32. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  33. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/C.includecache +190 -0
  34. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/DependInfo.cmake +29 -0
  35. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/autolink.c.o +0 -0
  36. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/build.make +249 -0
  37. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/cmake_clean.cmake +15 -0
  38. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/cmake_clean_target.cmake +3 -0
  39. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/core-extensions.c.o +0 -0
  40. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/depend.internal +92 -0
  41. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/depend.make +92 -0
  42. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/ext_scanners.c.o +0 -0
  43. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/flags.make +10 -0
  44. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/link.txt +2 -0
  45. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/progress.make +8 -0
  46. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/strikethrough.c.o +0 -0
  47. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/table.c.o +0 -0
  48. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmarkextensions_static.dir/whitelist.c.o +0 -0
  49. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/progress.marks +1 -0
  50. data/ext/commonmarker/cmark/build/extensions/Makefile +390 -0
  51. data/ext/commonmarker/cmark/build/extensions/cmake_install.cmake +29 -0
  52. data/ext/commonmarker/cmark/build/extensions/libcmarkextensions.a +0 -0
  53. data/ext/commonmarker/cmark/build/man/Makefile +9 -9
  54. data/ext/commonmarker/cmark/build/src/CMakeFiles/Export/lib/cmake/cmark.cmake +1 -1
  55. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/DependInfo.cmake +7 -19
  56. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/build.make +6 -517
  57. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/cmake_clean.cmake +0 -19
  58. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/flags.make +1 -1
  59. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/link.txt +1 -1
  60. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/progress.make +0 -19
  61. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/DependInfo.cmake +9 -0
  62. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/build.make +112 -4
  63. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/cmake_clean.cmake +4 -0
  64. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/flags.make +1 -1
  65. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/link.txt +1 -1
  66. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/progress.make +24 -20
  67. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/C.includecache +144 -10
  68. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/DependInfo.cmake +9 -0
  69. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/blocks.c.o +0 -0
  70. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/build.make +112 -4
  71. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmake_clean.cmake +4 -0
  72. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmark.c.o +0 -0
  73. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/commonmark.c.o +0 -0
  74. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/depend.internal +74 -0
  75. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/depend.make +74 -0
  76. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/flags.make +1 -1
  77. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/html.c.o +0 -0
  78. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/inlines.c.o +0 -0
  79. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/iterator.c.o +0 -0
  80. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/latex.c.o +0 -0
  81. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/link.txt +1 -1
  82. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/linked_list.c.o +0 -0
  83. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/man.c.o +0 -0
  84. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/node.c.o +0 -0
  85. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/plugin.c.o +0 -0
  86. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/progress.make +24 -20
  87. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/registry.c.o +0 -0
  88. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/scanners.c.o +0 -0
  89. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/syntax_extension.c.o +0 -0
  90. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/xml.c.o +0 -0
  91. data/ext/commonmarker/cmark/build/src/CMakeFiles/progress.marks +1 -1
  92. data/ext/commonmarker/cmark/build/src/Makefile +141 -66
  93. data/ext/commonmarker/cmark/build/src/cmake_install.cmake +4 -0
  94. data/ext/commonmarker/cmark/build/src/libcmark.a +0 -0
  95. data/ext/commonmarker/cmark/build/testdir/CTestTestfile.cmake +3 -1
  96. data/ext/commonmarker/cmark/build/testdir/Makefile +9 -9
  97. data/ext/commonmarker/cmark/extensions/CMakeLists.txt +82 -0
  98. data/ext/commonmarker/cmark/extensions/autolink.c +338 -0
  99. data/ext/commonmarker/cmark/extensions/autolink.h +8 -0
  100. data/ext/commonmarker/cmark/extensions/core-extensions.c +16 -0
  101. data/ext/commonmarker/cmark/extensions/core-extensions.h +16 -0
  102. data/ext/commonmarker/cmark/extensions/ext_scanners.c +585 -0
  103. data/ext/commonmarker/cmark/extensions/ext_scanners.h +20 -0
  104. data/ext/commonmarker/cmark/extensions/ext_scanners.re +65 -0
  105. data/ext/commonmarker/cmark/extensions/strikethrough.c +142 -0
  106. data/ext/commonmarker/cmark/extensions/strikethrough.h +9 -0
  107. data/ext/commonmarker/cmark/extensions/table.c +493 -0
  108. data/ext/commonmarker/cmark/extensions/table.h +8 -0
  109. data/ext/commonmarker/cmark/extensions/whitelist.c +59 -0
  110. data/ext/commonmarker/cmark/extensions/whitelist.h +8 -0
  111. data/ext/commonmarker/cmark/man/man3/cmark.3 +98 -34
  112. data/ext/commonmarker/cmark/src/CMakeLists.txt +16 -1
  113. data/ext/commonmarker/cmark/src/blocks.c +219 -40
  114. data/ext/commonmarker/cmark/src/buffer.h +36 -0
  115. data/ext/commonmarker/cmark/src/cmark.c +5 -1
  116. data/ext/commonmarker/cmark/src/cmark.h +91 -34
  117. data/ext/commonmarker/cmark/src/cmark_ctype.h +7 -0
  118. data/ext/commonmarker/cmark/src/cmark_extension_api.h +655 -0
  119. data/ext/commonmarker/cmark/src/commonmark.c +7 -2
  120. data/ext/commonmarker/cmark/src/houdini.h +12 -6
  121. data/ext/commonmarker/cmark/src/houdini_html_e.c +1 -1
  122. data/ext/commonmarker/cmark/src/html.c +102 -54
  123. data/ext/commonmarker/cmark/src/html.h +27 -0
  124. data/ext/commonmarker/cmark/src/inlines.c +261 -53
  125. data/ext/commonmarker/cmark/src/inlines.h +7 -2
  126. data/ext/commonmarker/cmark/src/iterator.c +12 -7
  127. data/ext/commonmarker/cmark/src/latex.c +5 -2
  128. data/ext/commonmarker/cmark/src/linked_list.c +37 -0
  129. data/ext/commonmarker/cmark/src/main.c +91 -27
  130. data/ext/commonmarker/cmark/src/man.c +18 -2
  131. data/ext/commonmarker/cmark/src/node.c +157 -58
  132. data/ext/commonmarker/cmark/src/node.h +23 -0
  133. data/ext/commonmarker/cmark/src/parser.h +19 -2
  134. data/ext/commonmarker/cmark/src/plugin.c +33 -0
  135. data/ext/commonmarker/cmark/src/plugin.h +34 -0
  136. data/ext/commonmarker/cmark/src/registry.c +60 -0
  137. data/ext/commonmarker/cmark/src/registry.h +24 -0
  138. data/ext/commonmarker/cmark/src/render.h +9 -0
  139. data/ext/commonmarker/cmark/src/scanners.c +265 -391
  140. data/ext/commonmarker/cmark/src/scanners.h +5 -0
  141. data/ext/commonmarker/cmark/src/scanners.re +2 -2
  142. data/ext/commonmarker/cmark/src/syntax_extension.c +110 -0
  143. data/ext/commonmarker/cmark/src/syntax_extension.h +27 -0
  144. data/ext/commonmarker/cmark/suppressions +28 -0
  145. data/ext/commonmarker/cmark/test/CMakeLists.txt +12 -1
  146. data/ext/commonmarker/cmark/test/extensions.txt +173 -0
  147. data/ext/commonmarker/cmark/test/regression.txt +24 -0
  148. data/ext/commonmarker/cmark/test/spec.txt +27 -26
  149. data/ext/commonmarker/cmark/toolchain-mingw32.cmake +1 -1
  150. data/ext/commonmarker/commonmarker.c +132 -15
  151. data/ext/commonmarker/commonmarker.h +4 -0
  152. data/ext/commonmarker/extconf.rb +12 -5
  153. data/lib/commonmarker.rb +8 -6
  154. data/lib/commonmarker/node.rb +13 -2
  155. data/lib/commonmarker/renderer.rb +1 -1
  156. data/lib/commonmarker/version.rb +1 -1
  157. data/test/test_commonmark.rb +34 -0
  158. data/test/test_encoding.rb +2 -1
  159. data/test/test_extensions.rb +50 -0
  160. data/test/test_helper.rb +2 -1
  161. metadata +65 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c3e63e431a27f384172714e6460c945c72b99f8
4
- data.tar.gz: dafacce9a5895793f2cd8709bd5f8083832a3e6e
3
+ metadata.gz: 3b2a4d70396ce1a2c123374d6a181b9352e16aa3
4
+ data.tar.gz: e20bbdc18ef23004a68790638b642018c68dabba
5
5
  SHA512:
6
- metadata.gz: 174f4b68f0e575d449fe8599fb62fc20c9bb015e13c3e4b751a880ef16e184083184732c4c1d88e882d9eb293fe281bde94301787829ac934efde2466f48da7a
7
- data.tar.gz: 3d40bca547a63f24e961a1fae3ffea86033c13789e3f86d11d1305888a567c2b0f21e217f63d1735ac90a68de31ba603e4f9f49f561c3e18717e5d8050478cf8
6
+ metadata.gz: 8fb647245e665c2d7b7533e88b77cb902c140983c8651579ff32d363d966c2439f835863d48b2d5d2011884d8f32d8df6a1d725a82886bba84248b69d521a6b7
7
+ data.tar.gz: c3ae8b2ba2790204a50744500418c40ed31f181435f230916172a13407106c85a26f1004c70b0724ff3524ff7a6f40b24e71ef4b654d02af5c19e05e0cb408b2
data/Rakefile CHANGED
@@ -3,6 +3,9 @@ require 'rake/clean'
3
3
  require 'rake/extensiontask'
4
4
  require 'digest/md5'
5
5
 
6
+ host_os = RbConfig::CONFIG['host_os']
7
+ require 'devkit' if host_os == 'mingw32'
8
+
6
9
  task :default => [:test]
7
10
 
8
11
  # Gem Spec
data/bin/commonmarker CHANGED
@@ -1,9 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
- # Usage: commonmarker [--html-renderer] [FILE..]
2
+ # Usage: commonmarker [--html-renderer] [--list-extensions] [--extension=EXTENSION] [FILE..]
3
3
  # Convert one or more CommonMark files to HTML and write to standard output.
4
4
  # If no FILE argument is provided, text will be read from STDIN.
5
5
  # With --html-renderer, use the HtmlRenderer renderer rather than the native C
6
6
  # renderer.
7
+ # With --extension=EXTENSION, EXTENSION will be used for parsing, and HTML
8
+ # output unless --html-renderer is specified.
7
9
  if ARGV.include?('--help') or ARGV.include?('-h')
8
10
  File.read(__FILE__).split("\n").grep(/^# /).each do |line|
9
11
  puts line[2..-1]
@@ -22,20 +24,34 @@ end
22
24
  root = File.expand_path('../../', __FILE__)
23
25
  $:.unshift File.expand_path('lib', root)
24
26
 
27
+ extensions = CommonMarker.extensions
28
+ active_extensions = []
29
+
25
30
  renderer = nil
26
31
  ARGV.delete_if do |arg|
27
32
  if arg =~ /^--html-renderer$/
28
33
  renderer = CommonMarker::HtmlRenderer.new
29
34
  true
35
+ elsif arg =~ /^--list-extensions$/
36
+ puts extensions
37
+ exit 0
38
+ elsif arg =~ /^--extension=(.+)$/
39
+ if extensions.include?($1)
40
+ active_extensions << $1
41
+ else
42
+ STDERR.puts "extension #$1 not found"
43
+ exit 1
44
+ end
45
+ true
30
46
  else
31
47
  false
32
48
  end
33
49
  end
34
50
 
35
- doc = CommonMarker.render_doc(ARGF.read)
51
+ doc = CommonMarker.render_doc(ARGF.read, :default, active_extensions)
36
52
 
37
53
  if renderer
38
54
  STDOUT.write(renderer.render(doc))
39
55
  else
40
- STDOUT.write(doc.to_html)
56
+ STDOUT.write(doc.to_html(:default, active_extensions))
41
57
  end
@@ -24,6 +24,7 @@ set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_
24
24
  option(CMARK_TESTS "Build cmark tests and enable testing" ON)
25
25
 
26
26
  add_subdirectory(src)
27
+ add_subdirectory(extensions)
27
28
  if(CMARK_TESTS)
28
29
  add_subdirectory(api_test)
29
30
  endif()
@@ -27,8 +27,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
27
 
28
28
  -----
29
29
 
30
- houdini.h, houdini_href_e.c, houdini_html_e.c, houdini_html_u.c,
31
- html_unescape.gperf, html_unescape.h
30
+ houdini.h, houdini_href_e.c, houdini_html_e.c, houdini_html_u.c
32
31
 
33
32
  derive from https://github.com/vmg/houdini (with some modifications)
34
33
 
@@ -104,7 +103,7 @@ DEALINGS IN THE SOFTWARE.
104
103
 
105
104
  -----
106
105
 
107
- The normalization code in runtests.py was derived from the
106
+ The normalization code in normalize.py was derived from the
108
107
  markdowntest project, Copyright 2013 Karl Dubost:
109
108
 
110
109
  The MIT License (MIT)
@@ -169,24 +168,3 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
169
168
  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
170
169
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
171
170
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
172
-
173
- -----
174
-
175
- The normalization code in runtests.py was derived from the
176
- markdowntest project, Copyright 2013 Karl Dubost:
177
-
178
- The MIT License (MIT)
179
-
180
- Copyright (c) 2013 Karl Dubost
181
-
182
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
183
-
184
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
185
-
186
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
187
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
188
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
189
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
190
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
191
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
192
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,10 +1,12 @@
1
1
  SRCDIR=src
2
+ EXTDIR=extensions
2
3
  DATADIR=data
3
4
  BUILDDIR?=build
4
5
  GENERATOR?=Unix Makefiles
5
6
  MINGW_BUILDDIR?=build-mingw
6
7
  MINGW_INSTALLDIR?=windows
7
8
  SPEC=test/spec.txt
9
+ EXTENSIONS_SPEC=test/extensions.txt
8
10
  SITE=_site
9
11
  SPECVERSION=$(shell perl -ne 'print $$1 if /^version: *([0-9.]+)/' $(SPEC))
10
12
  FUZZCHARS?=2000000 # for fuzztest
@@ -115,6 +117,19 @@ $(SRCDIR)/scanners.c: $(SRCDIR)/scanners.re
115
117
  --encoding-policy substitute -o $@ $<
116
118
  clang-format -style llvm -i $@
117
119
 
120
+ # We include scanners.c in the repository, so this shouldn't
121
+ # normally need to be generated.
122
+ $(EXTDIR)/ext_scanners.c: $(EXTDIR)/ext_scanners.re
123
+ @case "$$(re2c -v)" in \
124
+ *\ 0.13.*|*\ 0.14|*\ 0.14.1) \
125
+ echo "re2c >= 0.14.2 is required"; \
126
+ false; \
127
+ ;; \
128
+ esac
129
+ re2c --case-insensitive -b -i --no-generation-date -8 \
130
+ --encoding-policy substitute -o $@ $<
131
+ clang-format -style llvm -i $@
132
+
118
133
  # We include entities.inc in the repository, so normally this
119
134
  # doesn't need to be regenerated:
120
135
  $(SRCDIR)/entities.inc: tools/make_entities_inc.py
@@ -127,15 +142,20 @@ update-spec:
127
142
  test: $(SPEC) cmake_build
128
143
  $(MAKE) -C $(BUILDDIR) test || (cat $(BUILDDIR)/Testing/Temporary/LastTest.log && exit 1)
129
144
 
130
- $(ALLTESTS): $(SPEC)
131
- python3 test/spec_tests.py --spec $< --dump-tests | python3 -c 'import json; import sys; tests = json.loads(sys.stdin.read()); print("\n".join([test["markdown"] for test in tests]))' > $@
145
+ $(ALLTESTS): $(SPEC) $(EXTENSIONS_SPEC)
146
+ ( \
147
+ python3 test/spec_tests.py --spec $(SPEC) --dump-tests | \
148
+ python3 -c 'import json; import sys; tests = json.loads(sys.stdin.read()); print("\n".join([test["markdown"] for test in tests]))'; \
149
+ python3 test/spec_tests.py --spec $(EXTENSIONS_SPEC) --dump-tests | \
150
+ python3 -c 'import json; import sys; tests = json.loads(sys.stdin.read()); print("\n".join([test["markdown"] for test in tests]))'; \
151
+ ) > $@
132
152
 
133
153
  leakcheck: $(ALLTESTS)
134
154
  for format in html man xml latex commonmark; do \
135
155
  for opts in "" "--smart" "--normalize"; do \
136
- echo "cmark -t $$format $$opts" ; \
137
- valgrind -q --leak-check=full --dsymutil=yes --error-exitcode=1 $(PROG) -t $$format $$opts $(ALLTESTS) >/dev/null || exit 1;\
138
- done; \
156
+ echo "cmark -t $$format -e table -e strikethrough -e whitelist $$opts" ; \
157
+ valgrind -q --leak-check=full --dsymutil=yes --suppressions=suppressions --error-exitcode=1 $(PROG) -t $$format -e table -e strikethrough -e whitelist $$opts $(ALLTESTS) >/dev/null || exit 1;\
158
+ done; \
139
159
  done;
140
160
 
141
161
  fuzztest:
@@ -41,7 +41,7 @@ Advantages of this library:
41
41
  thousands-deep nested bracketed text or block quotes).
42
42
 
43
43
  - **Flexible.** CommonMark input is parsed to an AST which can be
44
- manipulated programatically prior to rendering.
44
+ manipulated programmatically prior to rendering.
45
45
 
46
46
  - **Multiple renderers.** Output in HTML, groff man, LaTeX, CommonMark,
47
47
  and a custom XML format is supported. And it is easy to write new
@@ -8,7 +8,7 @@ include_directories(
8
8
  ${PROJECT_SOURCE_DIR}/src
9
9
  ${PROJECT_BINARY_DIR}/src
10
10
  )
11
- target_link_libraries(api_test libcmark)
11
+ target_link_libraries(api_test libcmark ${CMAKE_DL_LIBS})
12
12
 
13
13
  # Compiler flags
14
14
  if(MSVC)
@@ -24,7 +24,7 @@ static void test_md_to_html(test_batch_runner *runner, const char *markdown,
24
24
  const char *expected_html, const char *msg);
25
25
 
26
26
  static void test_content(test_batch_runner *runner, cmark_node_type type,
27
- int allowed_content);
27
+ int *allowed_content);
28
28
 
29
29
  static void test_char(test_batch_runner *runner, int valid, const char *utf8,
30
30
  const char *msg);
@@ -177,7 +177,7 @@ static void accessors(test_batch_runner *runner) {
177
177
  OK(runner, cmark_node_set_literal(string, literal + sizeof("prefix")),
178
178
  "set_literal suffix");
179
179
 
180
- char *rendered_html = cmark_render_html(doc, CMARK_OPT_DEFAULT);
180
+ char *rendered_html = cmark_render_html(doc, CMARK_OPT_DEFAULT, NULL);
181
181
  static const char expected_html[] =
182
182
  "<h3>Header</h3>\n"
183
183
  "<ol start=\"3\">\n"
@@ -299,7 +299,7 @@ static void iterator_delete(test_batch_runner *runner) {
299
299
  }
300
300
  }
301
301
 
302
- char *html = cmark_render_html(doc, CMARK_OPT_DEFAULT);
302
+ char *html = cmark_render_html(doc, CMARK_OPT_DEFAULT, NULL);
303
303
  static const char expected[] = "<p>a c</p>\n"
304
304
  "<p>a c</p>\n";
305
305
  STR_EQ(runner, html, expected, "iterate and delete nodes");
@@ -339,7 +339,7 @@ static void create_tree(test_batch_runner *runner) {
339
339
  OK(runner, cmark_node_append_child(emph, str2), "append3");
340
340
  INT_EQ(runner, cmark_node_check(doc, NULL), 0, "append3 consistent");
341
341
 
342
- html = cmark_render_html(doc, CMARK_OPT_DEFAULT);
342
+ html = cmark_render_html(doc, CMARK_OPT_DEFAULT, NULL);
343
343
  STR_EQ(runner, html, "<p>Hello, <em>world</em>!</p>\n", "render_html");
344
344
  free(html);
345
345
 
@@ -375,7 +375,7 @@ static void create_tree(test_batch_runner *runner) {
375
375
 
376
376
  cmark_node_unlink(emph);
377
377
 
378
- html = cmark_render_html(doc, CMARK_OPT_DEFAULT);
378
+ html = cmark_render_html(doc, CMARK_OPT_DEFAULT, NULL);
379
379
  STR_EQ(runner, html, "<p>brzz!</p>\n", "render_html after shuffling");
380
380
  free(html);
381
381
 
@@ -407,7 +407,7 @@ static void custom_nodes(test_batch_runner *runner) {
407
407
  STR_EQ(runner, cmark_node_get_on_exit(cb), "", "get_on_exit (empty)");
408
408
  cmark_node_append_child(doc, cb);
409
409
 
410
- html = cmark_render_html(doc, CMARK_OPT_DEFAULT);
410
+ html = cmark_render_html(doc, CMARK_OPT_DEFAULT, NULL);
411
411
  STR_EQ(runner, html, "<p><ON ENTER|Hello|ON EXIT></p>\n<on enter|\n",
412
412
  "render_html");
413
413
  free(html);
@@ -434,22 +434,17 @@ void hierarchy(test_batch_runner *runner) {
434
434
 
435
435
  cmark_node_free(bquote1);
436
436
 
437
- int max_node_type = CMARK_NODE_LAST_BLOCK > CMARK_NODE_LAST_INLINE
438
- ? CMARK_NODE_LAST_BLOCK
439
- : CMARK_NODE_LAST_INLINE;
440
- OK(runner, max_node_type < 32, "all node types < 32");
441
-
442
- int list_item_flag = 1 << CMARK_NODE_ITEM;
443
- int top_level_blocks =
444
- (1 << CMARK_NODE_BLOCK_QUOTE) | (1 << CMARK_NODE_LIST) |
445
- (1 << CMARK_NODE_CODE_BLOCK) | (1 << CMARK_NODE_HTML_BLOCK) |
446
- (1 << CMARK_NODE_PARAGRAPH) | (1 << CMARK_NODE_HEADING) |
447
- (1 << CMARK_NODE_THEMATIC_BREAK);
448
- int all_inlines = (1 << CMARK_NODE_TEXT) | (1 << CMARK_NODE_SOFTBREAK) |
449
- (1 << CMARK_NODE_LINEBREAK) | (1 << CMARK_NODE_CODE) |
450
- (1 << CMARK_NODE_HTML_INLINE) | (1 << CMARK_NODE_EMPH) |
451
- (1 << CMARK_NODE_STRONG) | (1 << CMARK_NODE_LINK) |
452
- (1 << CMARK_NODE_IMAGE);
437
+ int list_item_flag[] = {CMARK_NODE_ITEM, 0};
438
+ int top_level_blocks[] =
439
+ {CMARK_NODE_BLOCK_QUOTE, CMARK_NODE_LIST,
440
+ CMARK_NODE_CODE_BLOCK, CMARK_NODE_HTML_BLOCK,
441
+ CMARK_NODE_PARAGRAPH, CMARK_NODE_HEADING,
442
+ CMARK_NODE_THEMATIC_BREAK, 0};
443
+ int all_inlines[] = {CMARK_NODE_TEXT, CMARK_NODE_SOFTBREAK,
444
+ CMARK_NODE_LINEBREAK, CMARK_NODE_CODE,
445
+ CMARK_NODE_HTML_INLINE, CMARK_NODE_EMPH,
446
+ CMARK_NODE_STRONG, CMARK_NODE_LINK,
447
+ CMARK_NODE_IMAGE, 0};
453
448
 
454
449
  test_content(runner, CMARK_NODE_DOCUMENT, top_level_blocks);
455
450
  test_content(runner, CMARK_NODE_BLOCK_QUOTE, top_level_blocks);
@@ -472,7 +467,7 @@ void hierarchy(test_batch_runner *runner) {
472
467
  }
473
468
 
474
469
  static void test_content(test_batch_runner *runner, cmark_node_type type,
475
- int allowed_content) {
470
+ int *allowed_content) {
476
471
  cmark_node *node = cmark_node_new(type);
477
472
 
478
473
  for (int i = 0; i < num_node_types; ++i) {
@@ -480,7 +475,10 @@ static void test_content(test_batch_runner *runner, cmark_node_type type,
480
475
  cmark_node *child = cmark_node_new(child_type);
481
476
 
482
477
  int got = cmark_node_append_child(node, child);
483
- int expected = (allowed_content >> child_type) & 1;
478
+ int expected = 0;
479
+ if (allowed_content)
480
+ for (int *p = allowed_content; *p; ++p)
481
+ expected |= *p == child_type;
484
482
 
485
483
  INT_EQ(runner, got, expected, "add %d as child of %d", child_type, type);
486
484
 
@@ -505,17 +503,17 @@ static void render_html(test_batch_runner *runner) {
505
503
  cmark_parse_document(markdown, sizeof(markdown) - 1, CMARK_OPT_DEFAULT);
506
504
 
507
505
  cmark_node *paragraph = cmark_node_first_child(doc);
508
- html = cmark_render_html(paragraph, CMARK_OPT_DEFAULT);
506
+ html = cmark_render_html(paragraph, CMARK_OPT_DEFAULT, NULL);
509
507
  STR_EQ(runner, html, "<p>foo <em>bar</em></p>\n", "render single paragraph");
510
508
  free(html);
511
509
 
512
510
  cmark_node *string = cmark_node_first_child(paragraph);
513
- html = cmark_render_html(string, CMARK_OPT_DEFAULT);
511
+ html = cmark_render_html(string, CMARK_OPT_DEFAULT, NULL);
514
512
  STR_EQ(runner, html, "foo ", "render single inline");
515
513
  free(html);
516
514
 
517
515
  cmark_node *emph = cmark_node_next(string);
518
- html = cmark_render_html(emph, CMARK_OPT_DEFAULT);
516
+ html = cmark_render_html(emph, CMARK_OPT_DEFAULT, NULL);
519
517
  STR_EQ(runner, html, "<em>bar</em>", "render inline with children");
520
518
  free(html);
521
519
 
@@ -1,6 +1,6 @@
1
1
  # This is the CMakeCache file.
2
2
  # For build in directory: /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build
3
- # It was generated by CMake: /usr/local/Cellar/cmake/3.6.0_1/bin/cmake
3
+ # It was generated by CMake: /usr/local/Cellar/cmake/3.6.1/bin/cmake
4
4
  # You can edit this file to change values found and used by cmake.
5
5
  # If you do not want to change any of the values, simply exit the editor.
6
6
  # If you do want to change a value, simply edit, save, and exit the editor.
@@ -260,6 +260,9 @@ libcmark_LIB_DEPENDS:STATIC=
260
260
  //Dependencies for target
261
261
  libcmark_static_LIB_DEPENDS:STATIC=
262
262
 
263
+ //Dependencies for target
264
+ libcmarkextensions_static_LIB_DEPENDS:STATIC=
265
+
263
266
 
264
267
  ########################
265
268
  # INTERNAL cache entries
@@ -274,15 +277,15 @@ CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
274
277
  //Minor version of cmake used to create the current loaded cache
275
278
  CMAKE_CACHE_MINOR_VERSION:INTERNAL=6
276
279
  //Patch version of cmake used to create the current loaded cache
277
- CMAKE_CACHE_PATCH_VERSION:INTERNAL=0
280
+ CMAKE_CACHE_PATCH_VERSION:INTERNAL=1
278
281
  //ADVANCED property for variable: CMAKE_COLOR_MAKEFILE
279
282
  CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1
280
283
  //Path to CMake executable.
281
- CMAKE_COMMAND:INTERNAL=/usr/local/Cellar/cmake/3.6.0_1/bin/cmake
284
+ CMAKE_COMMAND:INTERNAL=/usr/local/Cellar/cmake/3.6.1/bin/cmake
282
285
  //Path to cpack program executable.
283
- CMAKE_CPACK_COMMAND:INTERNAL=/usr/local/Cellar/cmake/3.6.0_1/bin/cpack
286
+ CMAKE_CPACK_COMMAND:INTERNAL=/usr/local/Cellar/cmake/3.6.1/bin/cpack
284
287
  //Path to ctest program executable.
285
- CMAKE_CTEST_COMMAND:INTERNAL=/usr/local/Cellar/cmake/3.6.0_1/bin/ctest
288
+ CMAKE_CTEST_COMMAND:INTERNAL=/usr/local/Cellar/cmake/3.6.1/bin/ctest
286
289
  //ADVANCED property for variable: CMAKE_CXX_COMPILER
287
290
  CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1
288
291
  //ADVANCED property for variable: CMAKE_CXX_FLAGS
@@ -312,7 +315,7 @@ CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
312
315
  //ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO
313
316
  CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
314
317
  //Path to cache edit program executable.
315
- CMAKE_EDIT_COMMAND:INTERNAL=/usr/local/Cellar/cmake/3.6.0_1/bin/ccmake
318
+ CMAKE_EDIT_COMMAND:INTERNAL=/usr/local/Cellar/cmake/3.6.1/bin/ccmake
316
319
  //Executable file format
317
320
  CMAKE_EXECUTABLE_FORMAT:INTERNAL=Unknown
318
321
  //ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS
@@ -389,7 +392,7 @@ CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
389
392
  //ADVANCED property for variable: CMAKE_NM
390
393
  CMAKE_NM-ADVANCED:INTERNAL=1
391
394
  //number of local generators
392
- CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=5
395
+ CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=6
393
396
  //ADVANCED property for variable: CMAKE_OBJCOPY
394
397
  CMAKE_OBJCOPY-ADVANCED:INTERNAL=1
395
398
  //ADVANCED property for variable: CMAKE_OBJDUMP
@@ -397,7 +400,7 @@ CMAKE_OBJDUMP-ADVANCED:INTERNAL=1
397
400
  //ADVANCED property for variable: CMAKE_RANLIB
398
401
  CMAKE_RANLIB-ADVANCED:INTERNAL=1
399
402
  //Path to CMake installation.
400
- CMAKE_ROOT:INTERNAL=/usr/local/Cellar/cmake/3.6.0_1/share/cmake
403
+ CMAKE_ROOT:INTERNAL=/usr/local/Cellar/cmake/3.6.1/share/cmake
401
404
  //ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS
402
405
  CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
403
406
  //ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_ASAN
@@ -439,7 +442,7 @@ COMPILER_HAS_HIDDEN_INLINE_VISIBILITY:INTERNAL=1
439
442
  //Test COMPILER_HAS_HIDDEN_VISIBILITY
440
443
  COMPILER_HAS_HIDDEN_VISIBILITY:INTERNAL=1
441
444
  //Details about finding PythonInterp
442
- FIND_PACKAGE_MESSAGE_DETAILS_PythonInterp:INTERNAL=[/usr/local/bin/python3][v3.5.1(3)]
445
+ FIND_PACKAGE_MESSAGE_DETAILS_PythonInterp:INTERNAL=[/usr/local/bin/python3][v3.5.2(3)]
443
446
  //Test HAVE_FLAG_ADDRESS_SANITIZER
444
447
  HAVE_FLAG_ADDRESS_SANITIZER:INTERNAL=
445
448
  //Test HAVE_FLAG_SANITIZE_ADDRESS
@@ -1,13 +1,13 @@
1
- set(CMAKE_HOST_SYSTEM "Darwin-15.5.0")
1
+ set(CMAKE_HOST_SYSTEM "Darwin-15.6.0")
2
2
  set(CMAKE_HOST_SYSTEM_NAME "Darwin")
3
- set(CMAKE_HOST_SYSTEM_VERSION "15.5.0")
3
+ set(CMAKE_HOST_SYSTEM_VERSION "15.6.0")
4
4
  set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5
5
 
6
6
 
7
7
 
8
- set(CMAKE_SYSTEM "Darwin-15.5.0")
8
+ set(CMAKE_SYSTEM "Darwin-15.6.0")
9
9
  set(CMAKE_SYSTEM_NAME "Darwin")
10
- set(CMAKE_SYSTEM_VERSION "15.5.0")
10
+ set(CMAKE_SYSTEM_VERSION "15.6.0")
11
11
  set(CMAKE_SYSTEM_PROCESSOR "x86_64")
12
12
 
13
13
  set(CMAKE_CROSSCOMPILING "FALSE")
@@ -1,14 +1,14 @@
1
1
  Performing C SOURCE FILE Test HAVE_FLAG_ADDRESS_SANITIZER failed with the following output:
2
2
  Change Dir: /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/CMakeFiles/CMakeTmp
3
3
 
4
- Run Build Command:"/usr/bin/make" "cmTC_c1cf9/fast"
5
- /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_c1cf9.dir/build.make CMakeFiles/cmTC_c1cf9.dir/build
6
- Building C object CMakeFiles/cmTC_c1cf9.dir/src.c.o
7
- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -fPIC -DHAVE_FLAG_ADDRESS_SANITIZER -Werror -faddress-sanitizer -faddress-sanitizer -o CMakeFiles/cmTC_c1cf9.dir/src.c.o -c /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/CMakeFiles/CMakeTmp/src.c
4
+ Run Build Command:"/usr/bin/make" "cmTC_4f28b/fast"
5
+ /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_4f28b.dir/build.make CMakeFiles/cmTC_4f28b.dir/build
6
+ Building C object CMakeFiles/cmTC_4f28b.dir/src.c.o
7
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -fPIC -DHAVE_FLAG_ADDRESS_SANITIZER -Werror -faddress-sanitizer -faddress-sanitizer -o CMakeFiles/cmTC_4f28b.dir/src.c.o -c /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/CMakeFiles/CMakeTmp/src.c
8
8
  clang: error: unknown argument: '-faddress-sanitizer'
9
9
  clang: error: unknown argument: '-faddress-sanitizer'
10
- make[1]: *** [CMakeFiles/cmTC_c1cf9.dir/src.c.o] Error 1
11
- make: *** [cmTC_c1cf9/fast] Error 2
10
+ make[1]: *** [CMakeFiles/cmTC_4f28b.dir/src.c.o] Error 1
11
+ make: *** [cmTC_4f28b/fast] Error 2
12
12
 
13
13
  Source file was:
14
14
  int main(void) { return 0; }