html_gen 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +27 -22
- data/VERSION +1 -1
- data/html_gen.gemspec +4 -3
- data/lib/html_gen/element.rb +8 -0
- data/spec/html_gen/element_spec.rb +23 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0caa0984cf638c98aa34059ecf9ec6b599b2510
|
4
|
+
data.tar.gz: 9e70c46f5f9bd745ef58a728968fec553b7e821c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e946a4f7bd60f2247a8bec36b9cc8ca9c9e23f924c640f3a58a2bcd0782dcf094ae9c50c679733906ffc00f3a020060078ff159c0189d432dec57337bd98db07
|
7
|
+
data.tar.gz: e763b9b9bf3e2316b8242353a55f3af5bf08b55243a294a7ca0893a6ad68e0aedf433f50b4dbe63e581842e8055bd828e8048373cb0ee2277dcb682b84f13de4
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
addressable (2.5.
|
4
|
+
addressable (2.5.1)
|
5
5
|
public_suffix (~> 2.0, >= 2.0.2)
|
6
|
-
ast (2.
|
6
|
+
ast (2.3.0)
|
7
7
|
auto_autoloader (0.0.5)
|
8
8
|
string-cases
|
9
9
|
best_practice_project (0.0.10)
|
10
10
|
auto_autoloader (>= 0.0.5)
|
11
11
|
builder (3.2.3)
|
12
|
-
codeclimate-test-reporter (0.
|
13
|
-
simplecov (
|
12
|
+
codeclimate-test-reporter (1.0.8)
|
13
|
+
simplecov (<= 0.13)
|
14
14
|
descendants_tracker (0.0.4)
|
15
15
|
thread_safe (~> 0.3, >= 0.3.1)
|
16
16
|
diff-lcs (1.3)
|
@@ -26,7 +26,7 @@ GEM
|
|
26
26
|
multi_json (>= 1.7.5, < 2.0)
|
27
27
|
nokogiri (~> 1.6.0)
|
28
28
|
oauth2
|
29
|
-
hashie (3.5.
|
29
|
+
hashie (3.5.6)
|
30
30
|
highline (1.7.8)
|
31
31
|
jeweler (2.3.3)
|
32
32
|
builder
|
@@ -39,27 +39,29 @@ GEM
|
|
39
39
|
rake
|
40
40
|
rdoc
|
41
41
|
semver2
|
42
|
-
json (1.8.
|
42
|
+
json (1.8.6)
|
43
43
|
jwt (1.5.6)
|
44
44
|
mini_portile2 (2.1.0)
|
45
|
-
multi_json (1.
|
45
|
+
multi_json (1.12.1)
|
46
46
|
multi_xml (0.6.0)
|
47
47
|
multipart-post (2.0.0)
|
48
48
|
nokogiri (1.6.8.1)
|
49
49
|
mini_portile2 (~> 2.1.0)
|
50
|
-
oauth2 (1.
|
51
|
-
faraday (>= 0.8, < 0.
|
50
|
+
oauth2 (1.4.0)
|
51
|
+
faraday (>= 0.8, < 0.13)
|
52
52
|
jwt (~> 1.0)
|
53
53
|
multi_json (~> 1.3)
|
54
54
|
multi_xml (~> 0.5)
|
55
55
|
rack (>= 1.2, < 3)
|
56
|
-
|
56
|
+
parallel (1.11.2)
|
57
|
+
parser (2.4.0.0)
|
57
58
|
ast (~> 2.2)
|
58
59
|
powerpack (0.1.1)
|
59
|
-
psych (2.2.
|
60
|
+
psych (2.2.4)
|
60
61
|
public_suffix (2.0.5)
|
61
|
-
rack (2.0.
|
62
|
-
rainbow (2.
|
62
|
+
rack (2.0.3)
|
63
|
+
rainbow (2.2.2)
|
64
|
+
rake
|
63
65
|
rake (12.0.0)
|
64
66
|
rdoc (3.12.2)
|
65
67
|
json (~> 1.4)
|
@@ -76,20 +78,23 @@ GEM
|
|
76
78
|
diff-lcs (>= 1.2.0, < 2.0)
|
77
79
|
rspec-support (~> 3.5.0)
|
78
80
|
rspec-support (3.5.0)
|
79
|
-
rubocop (0.
|
80
|
-
|
81
|
+
rubocop (0.49.1)
|
82
|
+
parallel (~> 1.10)
|
83
|
+
parser (>= 2.3.3.1, < 3.0)
|
81
84
|
powerpack (~> 0.1)
|
82
85
|
rainbow (>= 1.99.1, < 3.0)
|
83
86
|
ruby-progressbar (~> 1.7)
|
84
|
-
|
87
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
88
|
+
ruby-progressbar (1.8.1)
|
85
89
|
semver2 (3.4.2)
|
86
|
-
simplecov (0.
|
90
|
+
simplecov (0.13.0)
|
87
91
|
docile (~> 1.1.0)
|
88
|
-
|
89
|
-
simplecov-html (~> 0.
|
90
|
-
simplecov-html (0.
|
91
|
-
string-cases (0.0.
|
92
|
+
json (>= 1.8, < 3)
|
93
|
+
simplecov-html (~> 0.10.0)
|
94
|
+
simplecov-html (0.10.1)
|
95
|
+
string-cases (0.0.4)
|
92
96
|
thread_safe (0.3.6)
|
97
|
+
unicode-display_width (1.3.0)
|
93
98
|
|
94
99
|
PLATFORMS
|
95
100
|
ruby
|
@@ -105,4 +110,4 @@ DEPENDENCIES
|
|
105
110
|
string-cases
|
106
111
|
|
107
112
|
BUNDLED WITH
|
108
|
-
1.
|
113
|
+
1.15.1
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.16
|
data/html_gen.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: html_gen 0.0.
|
5
|
+
# stub: html_gen 0.0.16 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "html_gen".freeze
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.16"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Kasper Johansen".freeze]
|
14
|
-
s.date = "2017-
|
14
|
+
s.date = "2017-07-13"
|
15
15
|
s.description = "A small framework for generating HTML.".freeze
|
16
16
|
s.email = "k@spernj.org".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
"lib/html_gen/parser.rb",
|
36
36
|
"lib/html_gen/text_ele.rb",
|
37
37
|
"shippable.yml",
|
38
|
+
"spec/html_gen/element_spec.rb",
|
38
39
|
"spec/html_gen_parser_spec.rb",
|
39
40
|
"spec/html_gen_spec.rb",
|
40
41
|
"spec/spec_helper.rb"
|
data/lib/html_gen/element.rb
CHANGED
@@ -107,6 +107,14 @@ class HtmlGen::Element
|
|
107
107
|
ele
|
108
108
|
end
|
109
109
|
|
110
|
+
def add_html_if_safe(html)
|
111
|
+
if html.respond_to?(:html_safe?) && html.html_safe?
|
112
|
+
add_html(html)
|
113
|
+
else
|
114
|
+
add_str(html)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
110
118
|
# Returns the HTML for the element.
|
111
119
|
# To avoid indentation and newlines you can use the 'pretty'-argument:
|
112
120
|
# element.html(pretty: false)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe HtmlGen::Element do
|
4
|
+
describe "#add_html_if_safe" do
|
5
|
+
it "returns esacped html when not html safe" do
|
6
|
+
element = HtmlGen::Element.new(:div)
|
7
|
+
element.add_html_if_safe("<b>Hello world</b>")
|
8
|
+
|
9
|
+
expect(element.html(pretty: false)).to eq "<div><b>Hello world</b></div>"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "returns unescaped html when html safe" do
|
13
|
+
element = HtmlGen::Element.new(:div)
|
14
|
+
|
15
|
+
string_stub = "<b>Hello world</b>"
|
16
|
+
expect(string_stub).to receive(:html_safe?).and_return(true)
|
17
|
+
|
18
|
+
element.add_html_if_safe(string_stub)
|
19
|
+
|
20
|
+
expect(element.html(pretty: false)).to eq "<div><b>Hello world</b></div>"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html_gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kasper Johansen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: string-cases
|
@@ -132,6 +132,7 @@ files:
|
|
132
132
|
- lib/html_gen/parser.rb
|
133
133
|
- lib/html_gen/text_ele.rb
|
134
134
|
- shippable.yml
|
135
|
+
- spec/html_gen/element_spec.rb
|
135
136
|
- spec/html_gen_parser_spec.rb
|
136
137
|
- spec/html_gen_spec.rb
|
137
138
|
- spec/spec_helper.rb
|