escape_escape_escape 0.2.0 → 0.2.1
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/lib/escape_escape_escape.rb +22 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56c2a260ff14dda105a230c37578df362bef2925
|
4
|
+
data.tar.gz: 55285c2ba467f88aaee326e9a3bad7572e4c610e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cfb296f4134a0f1e342b1d9795857a4bb2a2df794717418fee8f77884edd397ade289f4750deafee8fa81e46d11dd5539a59ec3fd18f2f3b43028577bb64fde
|
7
|
+
data.tar.gz: 9636b1362c82148ea88e745105ecd7358394c62726a3941d2990133b7d7cc4e2d7273489bc94144c2771d7eebd3579930a65e0453eb29326e42e4362c7740578
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/escape_escape_escape.rb
CHANGED
@@ -11,6 +11,27 @@ class Escape_Escape_Escape
|
|
11
11
|
TABS = "\t"
|
12
12
|
CONTROL_CHARS = /[[:cntrl:]\x00-\x1f]/ # Don't use "\x20" because that is the space character.
|
13
13
|
WHITE_SPACE = /[[:space:]]&&[^\n]/ # http://www.rubyinside.com/the-split-is-not-enough-whitespace-shenigans-for-rubyists-5980.html
|
14
|
+
CONFIG = {
|
15
|
+
:attributes => Sanitize::Config::RELAXED[:attributes].dup,
|
16
|
+
:css => Sanitize::Config::RELAXED[:css].dup,
|
17
|
+
:allow_doctype => true,
|
18
|
+
:elements => %{
|
19
|
+
a blockquote body br caption cite code div
|
20
|
+
img pre p span
|
21
|
+
h1 h2 h3 h4
|
22
|
+
i em strong sub sup
|
23
|
+
ol li ul
|
24
|
+
html title style
|
25
|
+
},
|
26
|
+
:protocols => {
|
27
|
+
"a"=>{
|
28
|
+
"href"=>["ftp", "http", "https", "mailto", :relative]
|
29
|
+
},
|
30
|
+
"img"=>{
|
31
|
+
"src"=>["http", "https", :relative]
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
14
35
|
|
15
36
|
ENCODING_OPTIONS_CLEAN_UTF8 = {
|
16
37
|
:invalid => :replace, # Replace invalid byte sequences
|
@@ -46,7 +67,7 @@ class Escape_Escape_Escape
|
|
46
67
|
end
|
47
68
|
|
48
69
|
def html s
|
49
|
-
Sanitize.fragment( clean_utf8(s),
|
70
|
+
Sanitize.fragment( clean_utf8(s), CONFIG )
|
50
71
|
end
|
51
72
|
|
52
73
|
end # === class self ===
|