commonmarker 0.18.2 → 0.19.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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/Rakefile +10 -3
  4. data/bin/commonmarker +3 -1
  5. data/commonmarker.gemspec +7 -2
  6. data/ext/commonmarker/cmark-gfm-core-extensions.h +3 -0
  7. data/ext/commonmarker/cmark-gfm_version.h +2 -2
  8. data/ext/commonmarker/commonmark.c +4 -2
  9. data/ext/commonmarker/commonmarker.c +15 -0
  10. data/ext/commonmarker/core-extensions.c +2 -0
  11. data/ext/commonmarker/ext_scanners.c +738 -520
  12. data/ext/commonmarker/ext_scanners.h +2 -0
  13. data/ext/commonmarker/extconf.rb +3 -1
  14. data/ext/commonmarker/houdini_href_e.c +1 -1
  15. data/ext/commonmarker/inlines.c +4 -3
  16. data/ext/commonmarker/render.c +2 -1
  17. data/ext/commonmarker/scanners.c +2 -2
  18. data/ext/commonmarker/table.c +5 -3
  19. data/ext/commonmarker/tasklist.c +135 -0
  20. data/ext/commonmarker/tasklist.h +8 -0
  21. data/lib/commonmarker.rb +2 -0
  22. data/lib/commonmarker/config.rb +3 -1
  23. data/lib/commonmarker/node.rb +2 -0
  24. data/lib/commonmarker/renderer.rb +6 -2
  25. data/lib/commonmarker/renderer/html_renderer.rb +24 -2
  26. data/lib/commonmarker/version.rb +3 -1
  27. data/test/benchmark.rb +3 -1
  28. data/test/test_attributes.rb +3 -1
  29. data/test/test_basics.rb +2 -0
  30. data/test/test_commonmark.rb +2 -0
  31. data/test/test_doc.rb +2 -0
  32. data/test/test_encoding.rb +2 -0
  33. data/test/test_extensions.rb +24 -22
  34. data/test/test_footnotes.rb +2 -0
  35. data/test/test_gc.rb +4 -2
  36. data/test/test_helper.rb +11 -8
  37. data/test/test_linebreaks.rb +2 -0
  38. data/test/test_maliciousness.rb +2 -0
  39. data/test/test_node.rb +3 -1
  40. data/test/test_options.rb +2 -0
  41. data/test/test_pathological_inputs.rb +2 -0
  42. data/test/test_plaintext.rb +2 -0
  43. data/test/test_renderer.rb +2 -0
  44. data/test/test_smartpunct.rb +2 -0
  45. data/test/test_spec.rb +2 -0
  46. data/test/test_tasklists.rb +27 -0
  47. metadata +55 -9
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
 
3
5
  class TestFootnotes < Minitest::Test
data/test/test_gc.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
 
3
5
  class TestNode < Minitest::Test
@@ -11,7 +13,7 @@ class TestNode < Minitest::Test
11
13
  doc = nil
12
14
  GC.start
13
15
  # Test that doc has not been freed.
14
- assert_equal "there", text.string_content
16
+ assert_equal 'there', text.string_content
15
17
  end
16
18
 
17
19
  def test_drop_child_reference
@@ -21,7 +23,7 @@ class TestNode < Minitest::Test
21
23
  GC.start
22
24
  # Test that the cached child object is still valid.
23
25
  text = doc.first_child.last_child.first_child
24
- assert_equal "there", text.string_content
26
+ assert_equal 'there', text.string_content
25
27
  end
26
28
 
27
29
  def test_remove_parent
data/test/test_helper.rb CHANGED
@@ -1,7 +1,10 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require 'commonmarker'
3
5
  require 'minitest/autorun'
4
6
  require 'minitest/pride'
7
+ require 'minitest/focus'
5
8
 
6
9
  include CommonMarker
7
10
 
@@ -22,7 +25,7 @@ def open_spec_file(filename)
22
25
  header_re = Regexp.new('#+ ')
23
26
  filepath = File.join('ext', 'commonmarker', 'cmark-upstream', 'test', filename)
24
27
 
25
- File.readlines(filepath, encoding: "utf-8").each do |line|
28
+ File.readlines(filepath, encoding: 'utf-8').each do |line|
26
29
  line_number += 1
27
30
 
28
31
  l = line.strip
@@ -34,13 +37,13 @@ def open_spec_file(filename)
34
37
  example_number += 1
35
38
  end_line = line_number
36
39
  tests << {
37
- :markdown => markdown_lines.join('').tr('→', "\t"),
38
- :html => html_lines.join('').tr('→', "\t").rstrip,
39
- :example => example_number,
40
- :start_line => start_line,
41
- :end_line => end_line,
42
- :section => headertext,
43
- :extensions => extensions.map(&:to_sym),
40
+ markdown: markdown_lines.join('').tr('→', "\t"),
41
+ html: html_lines.join('').tr('→', "\t").rstrip,
42
+ example: example_number,
43
+ start_line: start_line,
44
+ end_line: end_line,
45
+ section: headertext,
46
+ extensions: extensions.map(&:to_sym),
44
47
  }
45
48
  start_line = 0
46
49
  markdown_lines = []
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
 
3
5
  class TestLinebreaks < Minitest::Test
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
 
3
5
  class CommonMarker::TestMaliciousness < Minitest::Test
data/test/test_node.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
 
3
5
  class TestNode < Minitest::Test
@@ -84,6 +86,6 @@ class TestNode < Minitest::Test
84
86
  end
85
87
 
86
88
  def test_pretty_print
87
- assert_match /#<CommonMarker::Node\(document\):/, PP.pp(@doc, '')
89
+ assert_match /#<CommonMarker::Node\(document\):/, PP.pp(@doc, ''.dup)
88
90
  end
89
91
  end
data/test/test_options.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
 
3
5
  class TestExtensions < Minitest::Test
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
  require 'minitest/benchmark' if ENV['BENCH']
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
 
3
5
  class TestPlaintext < Minitest::Test
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
 
3
5
  class TestRenderer < Minitest::Test
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
 
3
5
  class SmartPunctTest < Minitest::Test
data/test/test_spec.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
  require 'json'
3
5
 
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'test_helper'
4
+
5
+ class TestTasklists < Minitest::Test
6
+ def setup
7
+ text = <<-MD
8
+ - [x] Add task list
9
+ - [ ] Define task list
10
+ MD
11
+ @doc = CommonMarker.render_doc(text, :DEFAULT, %i[tasklist])
12
+ @expected = <<-HTML
13
+ <ul>
14
+ <li><input type="checkbox" checked="" disabled="" /> Add task list</li>
15
+ <li><input type="checkbox" disabled="" /> Define task list</li>
16
+ </ul>
17
+ HTML
18
+ end
19
+
20
+ def test_to_html
21
+ assert_equal @expected, @doc.to_html
22
+ end
23
+
24
+ def test_html_renderer
25
+ assert_equal @expected, CommonMarker::HtmlRenderer.new.render(@doc)
26
+ end
27
+ end
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.18.2
4
+ version: 0.19.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: 2018-11-28 00:00:00.000000000 Z
12
+ date: 2019-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby-enum
@@ -40,33 +40,33 @@ dependencies:
40
40
  - !ruby/object:Gem::Version
41
41
  version: '5.6'
42
42
  - !ruby/object:Gem::Dependency
43
- name: rake-compiler
43
+ name: minitest-focus
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '0.9'
48
+ version: '1.1'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '0.9'
55
+ version: '1.1'
56
56
  - !ruby/object:Gem::Dependency
57
- name: bundler
57
+ name: rake-compiler
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '1.2'
62
+ version: '0.9'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '1.2'
69
+ version: '0.9'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: json
72
72
  requirement: !ruby/object:Gem::Requirement
@@ -95,6 +95,20 @@ dependencies:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rake
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
98
112
  - !ruby/object:Gem::Dependency
99
113
  name: rdoc
100
114
  requirement: !ruby/object:Gem::Requirement
@@ -109,6 +123,34 @@ dependencies:
109
123
  - - "~>"
110
124
  - !ruby/object:Gem::Version
111
125
  version: '5.1'
126
+ - !ruby/object:Gem::Dependency
127
+ name: rubocop
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ - !ruby/object:Gem::Dependency
141
+ name: rubocop-standard
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
112
154
  description: A fast, safe, extensible parser for CommonMark. This wraps the official
113
155
  libcmark library.
114
156
  email:
@@ -189,6 +231,8 @@ files:
189
231
  - ext/commonmarker/table.h
190
232
  - ext/commonmarker/tagfilter.c
191
233
  - ext/commonmarker/tagfilter.h
234
+ - ext/commonmarker/tasklist.c
235
+ - ext/commonmarker/tasklist.h
192
236
  - ext/commonmarker/utf8.c
193
237
  - ext/commonmarker/utf8.h
194
238
  - ext/commonmarker/xml.c
@@ -220,7 +264,8 @@ files:
220
264
  - test/test_renderer.rb
221
265
  - test/test_smartpunct.rb
222
266
  - test/test_spec.rb
223
- homepage: http://github.com/gjtorikian/commonmarker
267
+ - test/test_tasklists.rb
268
+ homepage: https://github.com/gjtorikian/commonmarker
224
269
  licenses:
225
270
  - MIT
226
271
  metadata: {}
@@ -269,3 +314,4 @@ test_files:
269
314
  - test/test_renderer.rb
270
315
  - test/test_smartpunct.rb
271
316
  - test/test_spec.rb
317
+ - test/test_tasklists.rb