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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eda73d2e1ec602956e9dac7af185179cc676906adf4a34fd1a683685c391ed49
4
- data.tar.gz: c7668593f88170c009de8cc42839d69ec24834aec487baed336152eab1f979a4
3
+ metadata.gz: 499db7822b7a9628ffc8a755339c9498e727b60711b38c3433bf62340919dbcc
4
+ data.tar.gz: a742bdfd63e8a2bfe70d52b0912b68b3372194f182edaa9030f4db3b05034c48
5
5
  SHA512:
6
- metadata.gz: c85d82f860af997c13a4c6f3298a5ac1dfc1cfff668d28842b21f0e8723c4cc35cadb19fa4990070ba6fd3d735235d2ec0d1b54585e46a91ef229e3683af5ebf
7
- data.tar.gz: 5701ee21b4d273fcef7e6caab0af4401f8d67019aff1214327d092567fa73798690aebec32163aa890cd79eb6f4984c6e90a676eb2ffaee38fbfe7dc0137f80d
6
+ metadata.gz: d95e0f3b698b69bf8e3aaa9a8f84b2d79e28428e28b357512bfb74860b1dba3134b458fc9c7fbd62843ae570f228f3f8408bf0a033bd3b0e56c3de07284f5e08
7
+ data.tar.gz: 759170973e867985a62c8a1155d11dbcead9cafcade750f8d9089e1843544b8a6f04018741ec4dd9a1c8b1aff0f787700dcb194e4004303c7a60bb87d68a34e0
@@ -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.force_encoding('utf-8')
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
- value.to_s.gsub(@@nl2br_ptrn, '<br>')
226
+ value =CGI.unescape(value) if value && value.is_a?(String)
227
227
  end
228
228
  end
229
229
  private
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
3
  module HtmlGrid
4
- VERSION = '1.1.5'
4
+ VERSION = '1.1.6'
5
5
  end
@@ -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.5
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-04 00:00:00.000000000 Z
11
+ date: 2020-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sbsm