htmlgrid 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/htmlgrid/component.rb +6 -6
- data/lib/htmlgrid/version.rb +1 -1
- data/test/test_component.rb +19 -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: 499db7822b7a9628ffc8a755339c9498e727b60711b38c3433bf62340919dbcc
|
4
|
+
data.tar.gz: a742bdfd63e8a2bfe70d52b0912b68b3372194f182edaa9030f4db3b05034c48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d95e0f3b698b69bf8e3aaa9a8f84b2d79e28428e28b357512bfb74860b1dba3134b458fc9c7fbd62843ae570f228f3f8408bf0a033bd3b0e56c3de07284f5e08
|
7
|
+
data.tar.gz: 759170973e867985a62c8a1155d11dbcead9cafcade750f8d9089e1843544b8a6f04018741ec4dd9a1c8b1aff0f787700dcb194e4004303c7a60bb87d68a34e0
|
data/lib/htmlgrid/component.rb
CHANGED
@@ -22,8 +22,8 @@
|
|
22
22
|
# ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
|
23
23
|
# htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
|
24
24
|
#
|
25
|
-
# HtmlGrid::Component -- htmlgrid -- 23.12.2012 -- mhatakeyama@ywesee.com
|
26
|
-
# HtmlGrid::Component -- htmlgrid -- 23.10.2002 -- hwyss@ywesee.com
|
25
|
+
# HtmlGrid::Component -- htmlgrid -- 23.12.2012 -- mhatakeyama@ywesee.com
|
26
|
+
# HtmlGrid::Component -- htmlgrid -- 23.10.2002 -- hwyss@ywesee.com
|
27
27
|
#++
|
28
28
|
|
29
29
|
module HtmlGrid
|
@@ -72,7 +72,7 @@ module HtmlGrid
|
|
72
72
|
83 => "Sigma", 115 => "sigma",
|
73
73
|
84 => "Tau", 116 => "tau",
|
74
74
|
85 => "Upsilon", 117 => "upsilon",
|
75
|
-
86 => "sigmaf",
|
75
|
+
86 => "sigmaf",
|
76
76
|
87 => "Omega", 119 => "omega",
|
77
77
|
88 => "Xi", 120 => "xi",
|
78
78
|
89 => "Psi", 121 => "psi",
|
@@ -163,7 +163,7 @@ module HtmlGrid
|
|
163
163
|
end
|
164
164
|
# escape '&', '<' and '>' characters in txt
|
165
165
|
def escape(txt)
|
166
|
-
@@html_entities.inject(txt.to_s.dup) { |str, map|
|
166
|
+
@@html_entities.inject(txt.to_s.dup) { |str, map|
|
167
167
|
char, entity = map
|
168
168
|
str.gsub!(char, '&' << entity << ';')
|
169
169
|
str
|
@@ -214,7 +214,7 @@ module HtmlGrid
|
|
214
214
|
@attributes.store('tabIndex', tab.to_s)
|
215
215
|
end
|
216
216
|
def to_html(context)
|
217
|
-
_to_html(context, @value).to_s.
|
217
|
+
_to_html(context, @value).to_s.encode('utf-8')
|
218
218
|
end
|
219
219
|
@@nl2br_ptrn = /(\r\n)|(\n)|(\r)/
|
220
220
|
def _to_html(context, value=@value)
|
@@ -223,7 +223,7 @@ module HtmlGrid
|
|
223
223
|
elsif(value.respond_to?(:to_html))
|
224
224
|
value.to_html(context).to_s.force_encoding('utf-8')
|
225
225
|
else
|
226
|
-
|
226
|
+
value =CGI.unescape(value) if value && value.is_a?(String)
|
227
227
|
end
|
228
228
|
end
|
229
229
|
private
|
data/lib/htmlgrid/version.rb
CHANGED
data/test/test_component.rb
CHANGED
@@ -25,9 +25,11 @@
|
|
25
25
|
|
26
26
|
$: << File.expand_path("../lib", File.dirname(__FILE__))
|
27
27
|
$: << File.expand_path("../ext", File.dirname(__FILE__))
|
28
|
+
$: << File.dirname(__FILE__)
|
28
29
|
|
29
30
|
require 'minitest/autorun'
|
30
31
|
require 'htmlgrid/component'
|
32
|
+
require 'stub/cgi'
|
31
33
|
|
32
34
|
module HtmlGrid
|
33
35
|
class Component
|
@@ -36,6 +38,7 @@ module HtmlGrid
|
|
36
38
|
end
|
37
39
|
|
38
40
|
class TestComponent < Minitest::Test
|
41
|
+
STRING_WITH_UMLAUT = "Test_with_Umlaut_üé"
|
39
42
|
class StubAttributeComponent < HtmlGrid::Component
|
40
43
|
HTML_ATTRIBUTES = { "key" => "val" }
|
41
44
|
end
|
@@ -71,6 +74,22 @@ class TestComponent < Minitest::Test
|
|
71
74
|
assert_equal("bar", comp.session)
|
72
75
|
assert_equal("baz", comp.container)
|
73
76
|
end
|
77
|
+
def test_to_html
|
78
|
+
comp = HtmlGrid::Component.new("foo", "bar", "baz").to_html(CGI.new)
|
79
|
+
assert_equal("", comp)
|
80
|
+
end
|
81
|
+
def test_umlaut_to_html
|
82
|
+
comp = HtmlGrid::Component.new('context')
|
83
|
+
comp.value = STRING_WITH_UMLAUT
|
84
|
+
result = comp.to_html(CGI.new)
|
85
|
+
assert_equal(STRING_WITH_UMLAUT, result)
|
86
|
+
end
|
87
|
+
def test_escaped_STRING_WITH_UMLAUT_to_html
|
88
|
+
comp = HtmlGrid::Component.new('context')
|
89
|
+
comp.value =CGI.escape(STRING_WITH_UMLAUT)
|
90
|
+
result = comp.to_html(CGI.new)
|
91
|
+
assert_equal(STRING_WITH_UMLAUT, result)
|
92
|
+
end
|
74
93
|
def test_initialize3
|
75
94
|
comp = StubAttributeComponent.new("foo", "bar")
|
76
95
|
expected = { "key" => "val" }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: htmlgrid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masaomi Hatakeyama, Zeno R.R. Davatz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sbsm
|