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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/code/node/string.rb +4 -4
- data/lib/code/object/html.rb +3 -5
- data/lib/code/version.rb +1 -1
- data/spec/code_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f1a4ed575315f69d84456b831cf2a7af666a59bb38731d9556d94800b194d3c
|
4
|
+
data.tar.gz: e20431b754a5f8313d523b55a18308377f281946af28d142c4b7ce055d095d91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8616cf15597d618371da4ce000055f80ebf37f711d7d0e26b3396e07c79c2ab5dc1b408710e56a3b454c26e966d8b8f033d571762f066c75dda5eac84798c78b
|
7
|
+
data.tar.gz: 121bef5797084dfa8dca67d770b0bacd7d65383e62f2730d4033b2ce8d9d23e44c622ec0729d4e33f2f41c0e0a6b4f4e59e6d1a6ba16db22283b3c58aed89b10
|
data/Gemfile.lock
CHANGED
data/lib/code/node/string.rb
CHANGED
@@ -18,7 +18,7 @@ class Code
|
|
18
18
|
|
19
19
|
class Text < Node
|
20
20
|
def initialize(parsed)
|
21
|
-
return if parsed.
|
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.
|
42
|
+
return if parsed.nil?
|
43
43
|
|
44
44
|
if parsed.key?(:text)
|
45
|
-
@part = Node::String::Part::Text.new(parsed.delete(:text)
|
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)
|
47
|
+
@part = Node::String::Part::Code.new(parsed.delete(:code))
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
data/lib/code/object/html.rb
CHANGED
@@ -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
|
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.
|
38
|
+
String.new(CGI.escapeHTML(string.raw.to_s))
|
41
39
|
end
|
42
40
|
end
|
43
41
|
end
|
data/lib/code/version.rb
CHANGED
data/spec/code_spec.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2024-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|