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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45be3ace0d7870004c297d3b504a04922d1d80cd
4
- data.tar.gz: 8b1068701f4907d576c7e543ee49ba381f57fbfb
3
+ metadata.gz: b0caa0984cf638c98aa34059ecf9ec6b599b2510
4
+ data.tar.gz: 9e70c46f5f9bd745ef58a728968fec553b7e821c
5
5
  SHA512:
6
- metadata.gz: bd421565eb57651260adfda78b763dde5e6a603aa1df844339e7a86a8c9a83cbecde1aab093ea1632087e17d2da5b47868ff40759798fad64d0434828803121c
7
- data.tar.gz: 86b345b9bfa59793f45afd125b81f9e868b5352562cfcc91b956b5f9234acdf9d936369e693ecced8a37c3cc1d106aa698faa9105b93d73482a5157acbcbd498
6
+ metadata.gz: e946a4f7bd60f2247a8bec36b9cc8ca9c9e23f924c640f3a58a2bcd0782dcf094ae9c50c679733906ffc00f3a020060078ff159c0189d432dec57337bd98db07
7
+ data.tar.gz: e763b9b9bf3e2316b8242353a55f3af5bf08b55243a294a7ca0893a6ad68e0aedf433f50b4dbe63e581842e8055bd828e8048373cb0ee2277dcb682b84f13de4
@@ -1,16 +1,16 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- addressable (2.5.0)
4
+ addressable (2.5.1)
5
5
  public_suffix (~> 2.0, >= 2.0.2)
6
- ast (2.2.0)
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.4.6)
13
- simplecov (>= 0.7.1, < 1.0.0)
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.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.2)
42
+ json (1.8.6)
43
43
  jwt (1.5.6)
44
44
  mini_portile2 (2.1.0)
45
- multi_json (1.10.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.3.0)
51
- faraday (>= 0.8, < 0.11)
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
- parser (2.3.0.1)
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.2)
60
+ psych (2.2.4)
60
61
  public_suffix (2.0.5)
61
- rack (2.0.1)
62
- rainbow (2.0.0)
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.36.0)
80
- parser (>= 2.3.0.0, < 3.0)
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
- ruby-progressbar (1.7.5)
87
+ unicode-display_width (~> 1.0, >= 1.0.1)
88
+ ruby-progressbar (1.8.1)
85
89
  semver2 (3.4.2)
86
- simplecov (0.9.1)
90
+ simplecov (0.13.0)
87
91
  docile (~> 1.1.0)
88
- multi_json (~> 1.0)
89
- simplecov-html (~> 0.8.0)
90
- simplecov-html (0.8.0)
91
- string-cases (0.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.13.7
113
+ 1.15.1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.15
1
+ 0.0.16
@@ -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.15 ruby lib
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.15"
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-04-07"
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"
@@ -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>&lt;b&gt;Hello world&lt;/b&gt;</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.15
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-04-07 00:00:00.000000000 Z
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