dasil003-sanitize 1.1.0 → 1.1.1
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.
- data/HISTORY +8 -0
- data/README.rdoc +5 -0
- data/lib/sanitize.rb +7 -9
- data/lib/sanitize/version.rb +1 -1
- metadata +2 -2
data/HISTORY
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
Sanitize History
|
2
2
|
================================================================================
|
3
3
|
|
4
|
+
Version 1.1.1 (2009-10-14)
|
5
|
+
* Fixed formatting issue that was clobbering whitespace
|
6
|
+
|
7
|
+
Version 1.1.0 (2009-10-13)
|
8
|
+
* Add object_urls support for flash video embed
|
9
|
+
|
10
|
+
=== DASIL003 FORK ===
|
11
|
+
|
4
12
|
Version 1.1.0 (2009-10-11)
|
5
13
|
* Migrated from Hpricot to Nokogiri. Requires libxml2 >= 2.7.2 [Adam Hooper]
|
6
14
|
* Added an :output config setting to allow the output format to be specified.
|
data/README.rdoc
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
= Sanitize
|
2
2
|
|
3
|
+
*NOTICE: This is a forked version of sanitize that bakes crude flash
|
4
|
+
embed code support. Ryan is working on a transformations branch that
|
5
|
+
will allow this functionality to be implemented as middleware at which
|
6
|
+
point I plan on killing this fork.*
|
7
|
+
|
3
8
|
Sanitize is a whitelist-based HTML sanitizer. Given a list of acceptable
|
4
9
|
elements and attributes, Sanitize will remove all unacceptable HTML from a
|
5
10
|
string.
|
data/lib/sanitize.rb
CHANGED
@@ -144,23 +144,21 @@ class Sanitize
|
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
+
# Nokogiri 1.3.3 (and possibly earlier versions) always returns a US-ASCII
|
148
|
+
# string no matter what we ask for. This will be fixed in 1.4.0, but for
|
149
|
+
# now we have to hack around it to prevent errors.
|
150
|
+
output_method_params = {:encoding => 'utf-8', :indent => 0}
|
147
151
|
if @config[:output] == :xhtml
|
148
152
|
output_method = fragment.method(:to_xhtml)
|
153
|
+
output_method_params.merge!(:save_with => Nokogiri::XML::Node::SaveOptions::AS_XHTML)
|
149
154
|
elsif @config[:output] == :html
|
150
155
|
output_method = fragment.method(:to_html)
|
151
156
|
else
|
152
157
|
raise Error, "unsupported output format: #{@config[:output]}"
|
153
158
|
end
|
154
159
|
|
155
|
-
|
156
|
-
|
157
|
-
# string no matter what we ask for. This will be fixed in 1.4.0, but for
|
158
|
-
# now we have to hack around it to prevent errors.
|
159
|
-
result = output_method.call(:encoding => 'utf-8', :indent => 0).force_encoding('utf-8')
|
160
|
-
result.gsub!(">\n", '>')
|
161
|
-
else
|
162
|
-
result = output_method.call(:encoding => 'utf-8', :indent => 0).gsub(">\n", '>')
|
163
|
-
end
|
160
|
+
result = output_method.call(output_method_params)
|
161
|
+
result.force_encoding('utf-8') if RUBY_VERSION >= '1.9'
|
164
162
|
|
165
163
|
return result == html ? nil : html[0, html.length] = result
|
166
164
|
end
|
data/lib/sanitize/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dasil003-sanitize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Grove
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-10-
|
13
|
+
date: 2009-10-14 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|