commonmarker 0.14.15 → 0.15.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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/ext/commonmarker/cmark/Makefile +4 -3
  4. data/ext/commonmarker/cmark/README.md +18 -11
  5. data/ext/commonmarker/cmark/extensions/ext_scanners.c +562 -3
  6. data/ext/commonmarker/cmark/extensions/ext_scanners.h +6 -0
  7. data/ext/commonmarker/cmark/extensions/ext_scanners.re +32 -0
  8. data/ext/commonmarker/cmark/extensions/table.c +87 -215
  9. data/ext/commonmarker/cmark/man/CMakeLists.txt +2 -2
  10. data/ext/commonmarker/cmark/man/make_man_page.py +1 -1
  11. data/ext/commonmarker/cmark/man/man1/{cmark.1 → cmark-gfm.1} +10 -4
  12. data/ext/commonmarker/cmark/man/man3/cmark-gfm.3 +2 -2
  13. data/ext/commonmarker/cmark/src/buffer.c +5 -1
  14. data/ext/commonmarker/cmark/src/cmark.c +6 -2
  15. data/ext/commonmarker/cmark/src/cmark.h +1 -1
  16. data/ext/commonmarker/cmark/src/cmark_extension_api.h +0 -2
  17. data/ext/commonmarker/cmark/src/commonmark.c +1 -2
  18. data/ext/commonmarker/cmark/src/inlines.c +1 -1
  19. data/ext/commonmarker/cmark/src/libcmark-gfm.pc.in +1 -1
  20. data/ext/commonmarker/cmark/src/main.c +1 -1
  21. data/ext/commonmarker/cmark/src/render.c +15 -0
  22. data/ext/commonmarker/cmark/test/extensions.txt +24 -3
  23. data/ext/commonmarker/cmark/test/roundtrip_tests.py +1 -0
  24. data/ext/commonmarker/cmark/test/spec.txt +84 -15
  25. data/ext/commonmarker/cmark/test/spec_tests.py +9 -8
  26. data/ext/commonmarker/cmark/tools/Dockerfile +12 -0
  27. data/lib/commonmarker/node.rb +3 -0
  28. data/lib/commonmarker/node/inspect.rb +59 -0
  29. data/lib/commonmarker/version.rb +1 -1
  30. data/test/test_node.rb +8 -0
  31. data/test/test_spec.rb +1 -1
  32. metadata +4 -3
@@ -1,6 +1,9 @@
1
+ require 'commonmarker/node/inspect'
2
+
1
3
  module CommonMarker
2
4
  class Node
3
5
  include Enumerable
6
+ include Inspect
4
7
 
5
8
  # Public: An iterator that "walks the tree," descending into children recursively.
6
9
  #
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pp'
4
+
5
+ module CommonMarker
6
+ class Node
7
+ module Inspect
8
+ PP_INDENT_SIZE = 2
9
+
10
+ def inspect
11
+ PP.pp(self, String.new, Float::INFINITY)
12
+ end
13
+
14
+ # @param [PrettyPrint] pp
15
+ def pretty_print(pp)
16
+ pp.group(PP_INDENT_SIZE, "#<#{self.class}(#{type}):", '>') do
17
+ pp.breakable
18
+
19
+ attrs = %i[
20
+ sourcepos
21
+ string_content
22
+ url
23
+ title
24
+ header_level
25
+ list_type
26
+ list_start
27
+ list_tight
28
+ fence_info
29
+ ].map do |name|
30
+ begin
31
+ [name, __send__(name)]
32
+ rescue NodeError
33
+ nil
34
+ end
35
+ end.compact
36
+
37
+ pp.seplist(attrs) do |name, value|
38
+ pp.text "#{name}="
39
+ pp.pp value
40
+ end
41
+
42
+ if first_child
43
+ pp.breakable
44
+ pp.group(PP_INDENT_SIZE) do
45
+ children = []
46
+ node = first_child
47
+ while node
48
+ children << node
49
+ node = node.next
50
+ end
51
+ pp.text 'children='
52
+ pp.pp children
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -1,3 +1,3 @@
1
1
  module CommonMarker
2
- VERSION = '0.14.15'.freeze
2
+ VERSION = '0.15.0'.freeze
3
3
  end
data/test/test_node.rb CHANGED
@@ -78,4 +78,12 @@ class TestNode < Minitest::Test
78
78
  end
79
79
  assert_equal "<p>Hi there, I am mostly text!</p>\n", @doc.to_html
80
80
  end
81
+
82
+ def test_inspect
83
+ assert_match /#<CommonMarker::Node\(document\):/, @doc.inspect
84
+ end
85
+
86
+ def test_pretty_print
87
+ assert_match /#<CommonMarker::Node\(document\):/, PP.pp(@doc, '')
88
+ end
81
89
  end
data/test/test_spec.rb CHANGED
@@ -5,7 +5,7 @@ class TestSpec < Minitest::Test
5
5
  spec = open_spec_file('spec.txt')
6
6
 
7
7
  spec.each do |testcase|
8
- # next unless testcase['example'] == 420
8
+ next if testcase[:extensions].include?(:disabled)
9
9
  doc = CommonMarker.render_doc(testcase[:markdown], :DEFAULT, testcase[:extensions])
10
10
 
11
11
  define_method("test_to_html_example_#{testcase[:example]}") do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commonmarker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.15
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-04-03 00:00:00.000000000 Z
12
+ date: 2017-04-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby-enum
@@ -182,7 +182,7 @@ files:
182
182
  - ext/commonmarker/cmark/extensions/tagfilter.h
183
183
  - ext/commonmarker/cmark/man/CMakeLists.txt
184
184
  - ext/commonmarker/cmark/man/make_man_page.py
185
- - ext/commonmarker/cmark/man/man1/cmark.1
185
+ - ext/commonmarker/cmark/man/man1/cmark-gfm.1
186
186
  - ext/commonmarker/cmark/man/man3/cmark-gfm.3
187
187
  - ext/commonmarker/cmark/nmake.bat
188
188
  - ext/commonmarker/cmark/src/CMakeLists.txt
@@ -312,6 +312,7 @@ files:
312
312
  - lib/commonmarker.rb
313
313
  - lib/commonmarker/config.rb
314
314
  - lib/commonmarker/node.rb
315
+ - lib/commonmarker/node/inspect.rb
315
316
  - lib/commonmarker/renderer.rb
316
317
  - lib/commonmarker/renderer/html_renderer.rb
317
318
  - lib/commonmarker/version.rb