code-ruby 0.15.6 → 0.15.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb3a6cd530496f3eefa8f9aaccefbfad516a2c62c052682191f9fbed34ba1a37
4
- data.tar.gz: b5c27d958c5e9550a1ad324577c29afd5e020e39cb0f6576b9fc0ddadb760d80
3
+ metadata.gz: 8f1a4ed575315f69d84456b831cf2a7af666a59bb38731d9556d94800b194d3c
4
+ data.tar.gz: e20431b754a5f8313d523b55a18308377f281946af28d142c4b7ce055d095d91
5
5
  SHA512:
6
- metadata.gz: ebb21698f73cb8dfb6037f42028e258168fd5774a8971c822e605c39e1481a7d77e2491ec7a9b01a9e40937198c4d3fe90723fb1a5de35fee229ee27fc75da63
7
- data.tar.gz: d81cec1d8201406b997943db48576a711bffbe1e811cc125dc96e4c88517503f0bd2b7005da23e490f1e00feecfe6dbf673c8aea43c150391bd419f7bd7bc57c
6
+ metadata.gz: 8616cf15597d618371da4ce000055f80ebf37f711d7d0e26b3396e07c79c2ab5dc1b408710e56a3b454c26e966d8b8f033d571762f066c75dda5eac84798c78b
7
+ data.tar.gz: 121bef5797084dfa8dca67d770b0bacd7d65383e62f2730d4033b2ce8d9d23e44c622ec0729d4e33f2f41c0e0a6b4f4e59e6d1a6ba16db22283b3c58aed89b10
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- code-ruby (0.15.6)
4
+ code-ruby (0.15.8)
5
5
  activesupport
6
6
  bigdecimal
7
7
  did-you-mean
@@ -18,7 +18,7 @@ class Code
18
18
 
19
19
  class Text < Node
20
20
  def initialize(parsed)
21
- return if parsed.blank?
21
+ return if parsed.nil?
22
22
 
23
23
  @text = parsed
24
24
  end
@@ -39,12 +39,12 @@ class Code
39
39
  end
40
40
 
41
41
  def initialize(parsed)
42
- return if parsed.blank?
42
+ return if parsed.nil?
43
43
 
44
44
  if parsed.key?(:text)
45
- @part = Node::String::Part::Text.new(parsed.delete(:text).presence)
45
+ @part = Node::String::Part::Text.new(parsed.delete(:text))
46
46
  elsif parsed.key?(:code)
47
- @part = Node::String::Part::Code.new(parsed.delete(:code).presence)
47
+ @part = Node::String::Part::Code.new(parsed.delete(:code))
48
48
  end
49
49
  end
50
50
 
@@ -27,17 +27,15 @@ class Code
27
27
  text ||= Nothing.new
28
28
  href ||= Nothing.new
29
29
 
30
- String.new(<<~LINK)
31
- <a href=\"#{CGI.escape(href.raw.to_s)}\">
32
- #{CGI.escape(text.raw.to_s)}
33
- </a>
30
+ String.new(<<~LINK.strip)
31
+ <a href="#{CGI.escapeHTML(href.raw.to_s)}">#{CGI.escapeHTML(text.raw.to_s)}</a>
34
32
  LINK
35
33
  end
36
34
 
37
35
  def self.code_escape(string = nil)
38
36
  string ||= Nothing.new
39
37
 
40
- String.new(CGI.escape(string.raw.to_s))
38
+ String.new(CGI.escapeHTML(string.raw.to_s))
41
39
  end
42
40
  end
43
41
  end
data/lib/code/version.rb CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  require_relative "../code"
4
4
 
5
- Code::Version = Gem::Version.new("0.15.6")
5
+ Code::Version = Gem::Version.new("0.15.8")
data/spec/code_spec.rb CHANGED
@@ -302,6 +302,7 @@ RSpec.describe Code do
302
302
  ["[1, 2].join(',')", "'1,2'"],
303
303
  ["[nothing, 2].join(',')", "',2'"],
304
304
  ["[nothing, nothing].join", "''"],
305
+ ["'{1} {2}'", "'1 2'"],
305
306
  ["", ""]
306
307
  ].each do |input, expected|
307
308
  it "#{input} == #{expected}" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.6
4
+ version: 0.15.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-17 00:00:00.000000000 Z
11
+ date: 2024-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport