commonmarker 0.23.6 → 0.23.7.pre1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf9a7803972a4a9111e93837c8e47265ba83f10b3abd5cff73ec7375d862ef28
4
- data.tar.gz: a292683b676b06e8cb4a190e5bb60c5bc3e474c5d3b631701f7fab1f176d9a5f
3
+ metadata.gz: f41f7e434edcc989547b4cc9d02007ae0eed60c393bd6f7ee8a288f139c6b537
4
+ data.tar.gz: 1c92f108fb98a076cf403c9e643f8a10b96d8c7ef359293686a27173e1e70436
5
5
  SHA512:
6
- metadata.gz: '0884ee35781e71e96cbe7b87c4d8e885b13882e8b67fc594fe53a615410a00ed4599d7a99eab9347ca8f272fd93be31b06bea890a7b0c41a1a1407a717e4f3d2'
7
- data.tar.gz: ee9024ba7ee8b0143185ab41466b00b51349b55b70e12443ee11d68e640591ddab0e8073481e4cc19818fa56f82e1efbd29eaf0690203b4192b9602525169d06
6
+ metadata.gz: ee9ef9c3ff7bcee7d054e1961ce402ddc067a082ea969752346b9642510473547f1fa8aea5e534b5113b7035ea8ddacdbb67c50e2490585bc3d1197d888ea4ac
7
+ data.tar.gz: 74b8df6b443d787cb9ce7110e7cabc34d5a0233a865b8cb67839b9bf1b11b636c02cd107a119e4fc02ca1122d3e736b84fc3fba0a674f5bd17928e25e3c4e8cf
@@ -33,20 +33,22 @@ module CommonMarker
33
33
  format: [:html, :xml, :commonmark, :plaintext].freeze,
34
34
  }.freeze
35
35
 
36
- def self.process_options(option, type)
37
- case option
38
- when Symbol
39
- OPTS.fetch(type).fetch(option)
40
- when Array
41
- raise TypeError if option.none?
36
+ class << self
37
+ def process_options(option, type)
38
+ case option
39
+ when Symbol
40
+ OPTS.fetch(type).fetch(option)
41
+ when Array
42
+ raise TypeError if option.none?
42
43
 
43
- # neckbearding around. the map will both check the opts and then bitwise-OR it
44
- OPTS.fetch(type).fetch_values(*option).inject(0, :|)
45
- else
46
- raise TypeError, "option type must be a valid symbol or array of symbols within the #{name}::OPTS[:#{type}] context"
44
+ # neckbearding around. the map will both check the opts and then bitwise-OR it
45
+ OPTS.fetch(type).fetch_values(*option).inject(0, :|)
46
+ else
47
+ raise TypeError, "option type must be a valid symbol or array of symbols within the #{name}::OPTS[:#{type}] context"
48
+ end
49
+ rescue KeyError => e
50
+ raise TypeError, "option ':#{e.key}' does not exist for #{name}::OPTS[:#{type}]"
47
51
  end
48
- rescue KeyError => e
49
- raise TypeError, "option ':#{e.key}' does not exist for #{name}::OPTS[:#{type}]"
50
- end
52
+ end
51
53
  end
52
54
  end
@@ -113,7 +113,7 @@ module CommonMarker
113
113
  )
114
114
  (?=\s|>|/>)
115
115
  }xi,
116
- '&lt;\1'
116
+ '&lt;\1',
117
117
  )
118
118
  else
119
119
  str
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CommonMarker
4
- VERSION = "0.23.6"
4
+ VERSION = "0.23.7.pre1"
5
5
  end
data/lib/commonmarker.rb CHANGED
@@ -12,32 +12,34 @@ begin
12
12
  require "awesome_print"
13
13
  rescue LoadError; end # rubocop:disable Lint/SuppressedException
14
14
  module CommonMarker
15
- # Public: Parses a Markdown string into an HTML string.
16
- #
17
- # text - A {String} of text
18
- # option - Either a {Symbol} or {Array of Symbol}s indicating the render options
19
- # extensions - An {Array of Symbol}s indicating the extensions to use
20
- #
21
- # Returns a {String} of converted HTML.
22
- def self.render_html(text, options = :DEFAULT, extensions = [])
23
- raise TypeError, "text must be a String; got a #{text.class}!" unless text.is_a?(String)
15
+ class << self
16
+ # Public: Parses a Markdown string into an HTML string.
17
+ #
18
+ # text - A {String} of text
19
+ # option - Either a {Symbol} or {Array of Symbol}s indicating the render options
20
+ # extensions - An {Array of Symbol}s indicating the extensions to use
21
+ #
22
+ # Returns a {String} of converted HTML.
23
+ def render_html(text, options = :DEFAULT, extensions = [])
24
+ raise TypeError, "text must be a String; got a #{text.class}!" unless text.is_a?(String)
24
25
 
25
- opts = Config.process_options(options, :render)
26
- Node.markdown_to_html(text.encode("UTF-8"), opts, extensions)
27
- end
26
+ opts = Config.process_options(options, :render)
27
+ Node.markdown_to_html(text.encode("UTF-8"), opts, extensions)
28
+ end
28
29
 
29
- # Public: Parses a Markdown string into a `document` node.
30
- #
31
- # string - {String} to be parsed
32
- # option - A {Symbol} or {Array of Symbol}s indicating the parse options
33
- # extensions - An {Array of Symbol}s indicating the extensions to use
34
- #
35
- # Returns the `document` node.
36
- def self.render_doc(text, options = :DEFAULT, extensions = [])
37
- raise TypeError, "text must be a String; got a #{text.class}!" unless text.is_a?(String)
30
+ # Public: Parses a Markdown string into a `document` node.
31
+ #
32
+ # string - {String} to be parsed
33
+ # option - A {Symbol} or {Array of Symbol}s indicating the parse options
34
+ # extensions - An {Array of Symbol}s indicating the extensions to use
35
+ #
36
+ # Returns the `document` node.
37
+ def render_doc(text, options = :DEFAULT, extensions = [])
38
+ raise TypeError, "text must be a String; got a #{text.class}!" unless text.is_a?(String)
38
39
 
39
- opts = Config.process_options(options, :parse)
40
- text = text.encode("UTF-8")
41
- Node.parse_document(text, text.bytesize, opts, extensions)
42
- end
40
+ opts = Config.process_options(options, :parse)
41
+ text = text.encode("UTF-8")
42
+ Node.parse_document(text, text.bytesize, opts, extensions)
43
+ end
44
+ end
43
45
  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.23.6
4
+ version: 0.23.7.pre1
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: 2022-09-21 00:00:00.000000000 Z
12
+ date: 2022-11-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: awesome_print
@@ -251,11 +251,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
251
251
  version: '4.0'
252
252
  required_rubygems_version: !ruby/object:Gem::Requirement
253
253
  requirements:
254
- - - ">="
254
+ - - ">"
255
255
  - !ruby/object:Gem::Version
256
- version: '0'
256
+ version: 1.3.1
257
257
  requirements: []
258
- rubygems_version: 3.2.15
258
+ rubygems_version: 3.3.7
259
259
  signing_key:
260
260
  specification_version: 4
261
261
  summary: CommonMark parser and renderer. Written in C, wrapped in Ruby.