html_terminator 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/html_terminator/version.rb +1 -1
- data/lib/html_terminator.rb +2 -2
- data/spec/html_terminator_spec.rb +5 -0
- data/spec/spec_helper.rb +6 -4
- data/spec/support/active_record.rb +4 -4
- 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: bd4d0609098d033eece8510d9bee3dbd0cb09966
|
4
|
+
data.tar.gz: 96b86b54353b1b72afe70eac1fbed82257cc2896
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 650230f42f73afa03d5bcf6c37dc76e3cd253a5704a6bef83196a49b49d9847b39141b6f47be404681df422272cbd024f379f0b42595e17bee79eedcf4d55115
|
7
|
+
data.tar.gz: 4e0fa09f6dbb339404b9fd2c95d167ede09980151ff8f82c0bd3eb78c1eccc2067a05c256b993efdff4a1bfd513516ea7e323254b5ca31409b9a31931b695ebc
|
data/lib/html_terminator.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "html_terminator/version"
|
2
2
|
require "html_terminator/extract_options"
|
3
|
-
require
|
3
|
+
require "sanitize"
|
4
4
|
|
5
5
|
module HtmlTerminator
|
6
6
|
SANITIZE_OPTIONS = {
|
@@ -11,7 +11,7 @@ module HtmlTerminator
|
|
11
11
|
if val.is_a?(String)
|
12
12
|
# Sanitize produces escaped content.
|
13
13
|
# Unescape it to get the raw html
|
14
|
-
CGI.unescapeHTML
|
14
|
+
CGI.unescapeHTML(Sanitize.fragment(val, config).strip).html_safe
|
15
15
|
else
|
16
16
|
val
|
17
17
|
end
|
@@ -71,5 +71,10 @@ describe HtmlTerminator do
|
|
71
71
|
val = HtmlTerminator.sanitize "<flexbox></flexbox><hr><br><img>"
|
72
72
|
val.should == ""
|
73
73
|
end
|
74
|
+
|
75
|
+
it "marks the output as html_safe" do
|
76
|
+
val = HtmlTerminator.sanitize "<flexbox></flexbox><hr><br><img>"
|
77
|
+
val.html_safe?.should == true
|
78
|
+
end
|
74
79
|
end
|
75
80
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler/setup"
|
3
3
|
|
4
4
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__),
|
5
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
6
6
|
|
7
|
-
require
|
7
|
+
require "support/active_record"
|
8
|
+
require "active_support"
|
9
|
+
require "active_support/core_ext/string/output_safety.rb"
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "active_record"
|
2
|
+
require "html_terminator"
|
3
3
|
|
4
4
|
ActiveRecord::Base.establish_connection({
|
5
|
-
:adapter =>
|
6
|
-
:database =>
|
5
|
+
:adapter => "sqlite3",
|
6
|
+
:database => ":memory:"
|
7
7
|
})
|
8
8
|
|
9
9
|
ActiveRecord::Schema.define do
|