hpricot_scrub 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,10 @@
1
+ 2009-03-30 Mina Naguib <mina.hpricotscrub@naguib.ca>
2
+ Release 0.3.5
3
+ - Fixes for recent versions of hpricot:
4
+ - Fix fatal error scrubbing anything that has no children (such as an
5
+ EmptyElem)
6
+ - Fix fatal error removing elements with no children
7
+
1
8
  2008-11-02 Michael <michael@underpantsgnome.com>
2
9
  Release 0.3.4
3
10
  - Fix gem command test - Thanks David Masover
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ 2009-03-30 Mina Naguib <mina.hpricotscrub@naguib.ca>
2
+ Release 0.3.5
3
+ - Fixes for recent versions of hpricot:
4
+ - Fix fatal error scrubbing anything that has no children (such as an
5
+ EmptyElem)
6
+ - Fix fatal error removing elements with no children
7
+
1
8
  2008-11-02 Michael <michael@underpantsgnome.com>
2
9
  Release 0.3.4
3
10
  - Fix gem command test - Thanks David Masover
@@ -167,7 +167,11 @@ module Hpricot
167
167
  end
168
168
 
169
169
  def strip
170
- swap(inner_html)
170
+ if (i = inner_html) != ""
171
+ swap(i)
172
+ else
173
+ remove
174
+ end
171
175
  end
172
176
 
173
177
  #
@@ -189,7 +193,7 @@ module Hpricot
189
193
 
190
194
  config = Scrub::normalize_config(config)
191
195
 
192
- children.reverse.each do |child|
196
+ (children || []).reverse.each do |child|
193
197
  child.scrub(config) if child.scrubbable?
194
198
  end
195
199
 
@@ -2,7 +2,7 @@ module HpricotScrub #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 4
5
+ TINY = 5
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -93,6 +93,11 @@ class HpricotScrubTest < Test::Unit::TestCase
93
93
  end
94
94
  end
95
95
 
96
+ def test_elem_emptyelem
97
+ h = Hpricot("<br>")
98
+ assert_equal "", h.scrub.to_s
99
+ end
100
+
96
101
  def test_attr_default_rule_removes
97
102
  @scrubbed_docs.each do |doc|
98
103
  assert_equal 0, doc.search("*[@mce_src]").length
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hpricot_scrub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - UnderpantsGnome
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-02 01:00:00 -05:00
12
+ date: 2009-03-31 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.7.0
33
+ version: 1.9.0
34
34
  version:
35
35
  description: Scrub HTML with Hpricot
36
36
  email: michael@underpantsgnome.com
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  requirements: []
81
81
 
82
82
  rubyforge_project: hpricot-scrub
83
- rubygems_version: 1.2.0
83
+ rubygems_version: 1.3.1
84
84
  signing_key:
85
85
  specification_version: 2
86
86
  summary: Scrub HTML with Hpricot