hpricot_scrub 0.3.9 → 0.3.10

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/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg
data/CHANGELOG.txt CHANGED
@@ -1,7 +1,10 @@
1
- 2009-11-04 Matt Kelly
2
- Release 0.3.9
3
- - fix undefined method `scrubbable?' for #<Hpricot::DocType>
4
-
1
+ 2009-11-29 Mina Naguib <mina.hpricotscrub@naguib.ca>
2
+ Release 0.3.10
3
+ - Perma-fix recurrent breakage of missing scrubbable? on new Hpricot
4
+ entities
5
+ - Fix breakage with Hpricot 0.8.2's "attributes" not being a hash,
6
+ therefore not supporting #each
7
+
5
8
  2009-07-29 Mina Naguib <mina.hpricotscrub@naguib.ca>
6
9
  Release 0.3.8
7
10
  - fix undefined method `scrubbable?' for #<Hpricot::ProcIns>
data/History.txt CHANGED
@@ -1,7 +1,10 @@
1
- 2009-11-04 Matt Kelly
2
- Release 0.3.9
3
- - fix undefined method `scrubbable?' for #<Hpricot::DocType>
4
-
1
+ 2009-11-29 Mina Naguib <mina.hpricotscrub@naguib.ca>
2
+ Release 0.3.10
3
+ - Perma-fix recurrent breakage of missing scrubbable? on new Hpricot
4
+ entities
5
+ - Fix breakage with Hpricot 0.8.2's "attributes" not being a hash,
6
+ therefore not supporting #each
7
+
5
8
  2009-07-29 Mina Naguib <mina.hpricotscrub@naguib.ca>
6
9
  Release 0.3.8
7
10
  - fix undefined method `scrubbable?' for #<Hpricot::ProcIns>
data/Manifest.txt ADDED
@@ -0,0 +1,14 @@
1
+ Rakefile
2
+ README.txt
3
+ CHANGELOG.txt
4
+ History.txt
5
+ setup.rb
6
+ lib/hpricot_scrub/hpricot_scrub.rb
7
+ lib/hpricot_scrub/version.rb
8
+ lib/hpricot_scrub.rb
9
+ test/test_helper.rb
10
+ test/scrubber_data.rb
11
+ test/hpricot_scrub_test.rb
12
+ test/old_hpricot_scrub_test.rb
13
+ examples/config.yml
14
+ examples/old_config.yml
data/Rakefile CHANGED
@@ -1,53 +1,53 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
- require 'rake/clean'
4
- require 'rake/testtask'
5
- require 'rake/packagetask'
6
- require 'rake/gempackagetask'
7
- require 'rake/rdoctask'
8
- require 'rake/contrib/rubyforgepublisher'
9
- require 'fileutils'
10
- require 'hoe'
11
- include FileUtils
12
- require File.join(File.dirname(__FILE__), 'lib', 'hpricot_scrub', 'version')
13
3
 
14
- AUTHOR = "UnderpantsGnome" # can also be an array of Authors
15
- EMAIL = "michael@underpantsgnome.com"
16
- DESCRIPTION = "Scrub HTML with Hpricot"
17
- GEM_NAME = "hpricot_scrub" # what ppl will type to install your gem
18
- RUBYFORGE_PROJECT = "hpricot-scrub" # The unix name for your project
19
- HOMEPATH = "http://trac.underpantsgnome.com/hpricot_scrub/"
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "hpricot_scrub"
8
+ gem.summary = "Scrub HTML with Hpricot"
9
+ gem.description = "Scrub HTML with Hpricot like you would with perl HTML:Scrubber"
10
+ gem.email = "michael@underpantsgnome.com"
11
+ gem.homepage = "http://github.com/UnderpantsGnome/hpricot_scrub"
12
+ gem.authors = ["UnderpantsGnome (Michael Moen)", "minaguib (Mina Naguib)"]
13
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
14
+ gem.add_dependency 'hpricot', '>=0.8.1'
15
+ end
16
+ Jeweler::GemcutterTasks.new
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
+ end
20
20
 
21
- NAME = "hpricot_scrub"
22
- REV = nil # UNCOMMENT IF REQUIRED: File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
23
- VERS = ENV['VERSION'] || (HpricotScrub::VERSION::STRING + (REV ? ".#{REV}" : ""))
24
- CLEAN.include ['**/.*.sw?', '*.gem', '.config']
25
- RDOC_OPTS = ['--quiet', '--title', "hpricot_scrub documentation",
26
- "--opname", "index.html",
27
- "--line-numbers",
28
- "--main", "README",
29
- "--inline-source"]
21
+ require 'rake/testtask'
22
+ Rake::TestTask.new(:test) do |test|
23
+ test.libs << 'lib' << 'test'
24
+ test.pattern = 'test/**/*_test.rb'
25
+ test.verbose = true
26
+ end
30
27
 
31
- class Hoe
32
- def extra_deps
33
- @extra_deps.reject { |x| Array(x).first == 'hoe' }
34
- end
28
+ begin
29
+ require 'rcov/rcovtask'
30
+ Rcov::RcovTask.new do |test|
31
+ test.libs << 'test'
32
+ test.pattern = 'test/**/*_test.rb'
33
+ test.verbose = true
34
+ end
35
+ rescue LoadError
36
+ task :rcov do
37
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
38
+ end
35
39
  end
36
40
 
37
- # Generate all the Rake tasks
38
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
39
- hoe = Hoe.new(GEM_NAME, VERS) do |p|
40
- p.author = AUTHOR
41
- p.description = DESCRIPTION
42
- p.email = EMAIL
43
- p.summary = DESCRIPTION
44
- p.url = HOMEPATH
45
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
46
- p.test_globs = ["test/**/*_test.rb"]
47
- p.clean_globs = CLEAN #An array of file patterns to delete on clean.
48
-
49
- # == Optional
50
- #p.changes - A description of the release's latest changes.
51
- p.extra_deps = [['hpricot', '>= 0.5']]
52
- #p.spec_extras - A hash of extra values to set in the gemspec.
41
+ task :test => :check_dependencies
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "hpricot_scrub #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
53
  end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.3.10
@@ -0,0 +1,63 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{hpricot_scrub}
8
+ s.version = "0.3.10"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["UnderpantsGnome (Michael Moen)", "minaguib (Mina Naguib)"]
12
+ s.date = %q{2010-01-25}
13
+ s.description = %q{Scrub HTML with Hpricot like you would with perl HTML:Scrubber}
14
+ s.email = %q{michael@underpantsgnome.com}
15
+ s.extra_rdoc_files = [
16
+ "README.txt"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ "CHANGELOG.txt",
21
+ "History.txt",
22
+ "Manifest.txt",
23
+ "README.txt",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "examples/config.yml",
27
+ "examples/old_config.yml",
28
+ "hpricot_scrub.gemspec",
29
+ "lib/hpricot_scrub.rb",
30
+ "lib/hpricot_scrub/hpricot_scrub.rb",
31
+ "lib/hpricot_scrub/version.rb",
32
+ "setup.rb",
33
+ "test/hpricot_scrub_test.rb",
34
+ "test/old_hpricot_scrub_test.rb",
35
+ "test/scrubber_data.rb",
36
+ "test/test_helper.rb"
37
+ ]
38
+ s.homepage = %q{http://github.com/UnderpantsGnome/hpricot_scrub}
39
+ s.rdoc_options = ["--charset=UTF-8"]
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = %q{1.3.5}
42
+ s.summary = %q{Scrub HTML with Hpricot}
43
+ s.test_files = [
44
+ "test/hpricot_scrub_test.rb",
45
+ "test/old_hpricot_scrub_test.rb",
46
+ "test/scrubber_data.rb",
47
+ "test/test_helper.rb"
48
+ ]
49
+
50
+ if s.respond_to? :specification_version then
51
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
52
+ s.specification_version = 3
53
+
54
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
55
+ s.add_runtime_dependency(%q<hpricot>, [">= 0.8.1"])
56
+ else
57
+ s.add_dependency(%q<hpricot>, [">= 0.8.1"])
58
+ end
59
+ else
60
+ s.add_dependency(%q<hpricot>, [">= 0.8.1"])
61
+ end
62
+ end
63
+
@@ -115,14 +115,6 @@ module Hpricot
115
115
 
116
116
  end
117
117
 
118
- module Scrubbable
119
- def scrubbable?
120
- ! [ Hpricot::Text,
121
- Hpricot::BogusETag,
122
- ].include?(self.class) && self.respond_to?(:scrub)
123
- end
124
- end
125
-
126
118
  end
127
119
 
128
120
  class Elements
@@ -135,32 +127,7 @@ module Hpricot
135
127
  end
136
128
  end
137
129
 
138
- class DocType
139
- include Scrub::Scrubbable
140
- end
141
-
142
- class BogusETag
143
- include Scrub::Scrubbable
144
- end
145
-
146
- class Text
147
- include Scrub::Scrubbable
148
- end
149
-
150
- class BaseEle
151
- include Scrub::Scrubbable
152
- end
153
-
154
- class CData
155
- include Scrub::Scrubbable
156
- end
157
-
158
- class ProcIns
159
- include Scrub::Scrubbable
160
- end
161
-
162
130
  class Comment
163
- include Scrub::Scrubbable
164
131
 
165
132
  def remove
166
133
  parent.children.delete(self)
@@ -180,7 +147,6 @@ module Hpricot
180
147
  end
181
148
 
182
149
  class Elem
183
- include Scrub::Scrubbable
184
150
 
185
151
  def remove
186
152
  parent.children.delete(self)
@@ -214,7 +180,7 @@ module Hpricot
214
180
  config = Scrub::normalize_config(config)
215
181
 
216
182
  (children || []).reverse.each do |child|
217
- child.scrub(config) if child.scrubbable?
183
+ child.scrub(config) if child.respond_to?(:scrub)
218
184
  end
219
185
 
220
186
  rule = config[:elem_rules].has_key?(name) ? config[:elem_rules][name] : config[:default_elem_rule]
@@ -241,8 +207,8 @@ module Hpricot
241
207
  # Loops over all the attributes on this element, and removes any which Hpricot::Scrub.keep_attribute? returns false for
242
208
  #
243
209
  def scrub_attributes(attribute_rule = nil)
244
- if attributes
245
- attributes.each do |key, value|
210
+ if raw_attributes
211
+ raw_attributes.each do |key, value|
246
212
  remove_attribute(key) unless Scrub.keep_attribute?(self, key, value, attribute_rule)
247
213
  end
248
214
  end
@@ -262,7 +228,7 @@ module Hpricot
262
228
  def scrub(config=nil)
263
229
  config = Scrub::normalize_config(config)
264
230
  (children || []).reverse.each do |child|
265
- child.scrub(config) if child.scrubbable?
231
+ child.scrub(config) if child.respond_to?(:scrub)
266
232
  end
267
233
  return self
268
234
  end
@@ -2,7 +2,7 @@ module HpricotScrub #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 9
5
+ TINY = 10
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hpricot_scrub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
- - UnderpantsGnome
7
+ - UnderpantsGnome (Michael Moen)
8
+ - minaguib (Mina Naguib)
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2009-11-05 00:00:00 -06:00
13
+ date: 2010-01-25 00:00:00 -06:00
13
14
  default_executable:
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
@@ -20,19 +21,9 @@ dependencies:
20
21
  requirements:
21
22
  - - ">="
22
23
  - !ruby/object:Gem::Version
23
- version: "0.5"
24
+ version: 0.8.1
24
25
  version:
25
- - !ruby/object:Gem::Dependency
26
- name: hoe
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 2.3.3
34
- version:
35
- description: Scrub HTML with Hpricot
26
+ description: Scrub HTML with Hpricot like you would with perl HTML:Scrubber
36
27
  email: michael@underpantsgnome.com
37
28
  executables: []
38
29
 
@@ -40,31 +31,32 @@ extensions: []
40
31
 
41
32
  extra_rdoc_files:
42
33
  - README.txt
43
- - CHANGELOG.txt
44
- - History.txt
45
34
  files:
46
- - Rakefile
47
- - README.txt
35
+ - .gitignore
48
36
  - CHANGELOG.txt
49
37
  - History.txt
50
- - setup.rb
38
+ - Manifest.txt
39
+ - README.txt
40
+ - Rakefile
41
+ - VERSION
42
+ - examples/config.yml
43
+ - examples/old_config.yml
44
+ - hpricot_scrub.gemspec
45
+ - lib/hpricot_scrub.rb
51
46
  - lib/hpricot_scrub/hpricot_scrub.rb
52
47
  - lib/hpricot_scrub/version.rb
53
- - lib/hpricot_scrub.rb
54
- - test/test_helper.rb
55
- - test/scrubber_data.rb
48
+ - setup.rb
56
49
  - test/hpricot_scrub_test.rb
57
50
  - test/old_hpricot_scrub_test.rb
58
- - examples/config.yml
59
- - examples/old_config.yml
51
+ - test/scrubber_data.rb
52
+ - test/test_helper.rb
60
53
  has_rdoc: true
61
- homepage: http://trac.underpantsgnome.com/hpricot_scrub/
54
+ homepage: http://github.com/UnderpantsGnome/hpricot_scrub
62
55
  licenses: []
63
56
 
64
57
  post_install_message:
65
58
  rdoc_options:
66
- - --main
67
- - README.txt
59
+ - --charset=UTF-8
68
60
  require_paths:
69
61
  - lib
70
62
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -81,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
73
  version:
82
74
  requirements: []
83
75
 
84
- rubyforge_project: hpricot-scrub
76
+ rubyforge_project:
85
77
  rubygems_version: 1.3.5
86
78
  signing_key:
87
79
  specification_version: 3
@@ -89,3 +81,5 @@ summary: Scrub HTML with Hpricot
89
81
  test_files:
90
82
  - test/hpricot_scrub_test.rb
91
83
  - test/old_hpricot_scrub_test.rb
84
+ - test/scrubber_data.rb
85
+ - test/test_helper.rb