escape_escape_escape 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/escape_escape_escape.gemspec +1 -0
- data/lib/escape_escape_escape.rb +11 -0
- data/specs/as_json/0002-inner_html.json +16 -0
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7232497e102ab2bd27d1892c77ec7eb9f2957e27
|
4
|
+
data.tar.gz: 263451a1649efb22f1fc21457c240b29ad3de001
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 065639dcd17ec6ed58702292f1a1f5d637aa5b4220ba3644a7b8823f63432f6d9c99502d22fc5cf0d5592323959edeb6ac4f31ee212f38f0f0ef212fad670d0c
|
7
|
+
data.tar.gz: 2efc664d236dc1c7eb9aa4f0347daab1e453b34ee77fc788b28187dd179a64efe803855ea1a9ef3e48ace9268637d2d318de60c8052af1393b96f15799ea59b0
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
24
|
spec.add_dependency "sanitize" , ">= 3.0"
|
25
|
+
spec.add_dependency "htmlentities" , ">= 4.3.2"
|
25
26
|
|
26
27
|
spec.add_development_dependency "pry" , ">= 0.9"
|
27
28
|
spec.add_development_dependency "rake" , ">= 10.3"
|
data/lib/escape_escape_escape.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
|
2
2
|
|
3
3
|
require "sanitize"
|
4
|
+
require "htmlentities"
|
4
5
|
|
5
6
|
class Escape_Escape_Escape
|
6
7
|
|
8
|
+
CODER = HTMLEntities.new(:xhtml1)
|
9
|
+
|
7
10
|
REPEATING_DOTS = /\.{1,}\//
|
8
11
|
INVALID_FILE_NAME_CHARS = /[^a-z0-9\_\.]{1,}/i
|
9
12
|
UN_PRINT_ABLE = /[^[:print:]\n]/
|
@@ -70,6 +73,14 @@ class Escape_Escape_Escape
|
|
70
73
|
Sanitize.fragment( clean_utf8(s), CONFIG )
|
71
74
|
end
|
72
75
|
|
76
|
+
def unescape_inner_html s
|
77
|
+
CODER.decode(clean_utf8(s))
|
78
|
+
end
|
79
|
+
|
80
|
+
def inner_html s
|
81
|
+
CODER.encode(unescape_inner_html(s), :named, :hexadecimal)
|
82
|
+
end
|
83
|
+
|
73
84
|
end # === class self ===
|
74
85
|
|
75
86
|
end # === class Escape_Escape_Escape ===
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
[
|
3
|
+
|
4
|
+
{
|
5
|
+
"it" : "does not re-encoded already encoded text",
|
6
|
+
"input" : "Hello & GoodBye",
|
7
|
+
"output" : "Hello & GoodBye"
|
8
|
+
},
|
9
|
+
|
10
|
+
{
|
11
|
+
"it" : "encodes special characters: ©",
|
12
|
+
"input" : "Chars: ©",
|
13
|
+
"output" : "Chars: ©"
|
14
|
+
}
|
15
|
+
|
16
|
+
]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: escape_escape_escape
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- da99
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: htmlentities
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.3.2
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 4.3.2
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: pry
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,6 +141,7 @@ files:
|
|
127
141
|
- lib/escape_escape_escape.rb
|
128
142
|
- package.json
|
129
143
|
- specs/as_json/0001-html.json
|
144
|
+
- specs/as_json/0002-inner_html.json
|
130
145
|
- specs/as_json/0010-text.json
|
131
146
|
- specs/escape_escape_escape.rb
|
132
147
|
- specs/helpers.rb
|