hpricot_scrub 0.1.0

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.
@@ -0,0 +1,18 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+ require File.dirname(__FILE__) + '/scrubber_data.rb'
3
+
4
+ class HpricotScrubTest < Test::Unit::TestCase
5
+
6
+ def setup
7
+ end
8
+
9
+ def test_full_scrub
10
+ # using the divisor search throws warnings in test
11
+ doc = Hpricot(MARKUP).scrub
12
+ assert doc.search('//a').size == 0
13
+ assert doc.search('//p').size == 0
14
+ assert doc.search('//img').size == 0
15
+ assert doc.search('//br').size == 0
16
+ assert doc.search('//script').size == 0
17
+ end
18
+ end
@@ -0,0 +1,12 @@
1
+ MARKUP = <<-EOS
2
+ <p>Some <b>bold junk</b> here...</p>
3
+ <p>Some more junk <i>here...</i><br></p>
4
+ <p>Still more junk <u>here</u>... </p>
5
+ <p><img title="nothing to see here" alt="nothing to see here" mce_src="http://example.com/imgtest.png" src="http://example.com/imgtest.png" align="middle" border="1" height="240" hspace="5" vspace="5" width="320">&nbsp;</p>
6
+ <p>&nbsp;And a <a title="Just a link" target="_blank" mce_href="http://example.com/nothing.html" href="http://example.com/nothing.html">link</a> just because</p>
7
+ <a name="junk"></a>
8
+ <script type="text/javascript">//nasty bits go here
9
+ alert("gotcha");</script><img src="http://content.example.com/content/3587a2f6ee641074fec4e7534c01655326c218ec">how about an <a href="javascript:alert('gotcha')">inline script</a>
10
+ <span>some random unclosed span
11
+ <style type="text/css">.foo {color:blue}</style>
12
+ EOS
@@ -0,0 +1,2 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../lib/hpricot_scrub'
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.1
3
+ specification_version: 1
4
+ name: hpricot_scrub
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.1.0
7
+ date: 2007-03-04 00:00:00 -08:00
8
+ summary: Scrub HTML with Hpricot
9
+ require_paths:
10
+ - lib
11
+ email: michael@underpantsgnome.com
12
+ homepage: http://trac.underpantsgnome.com/hpricot_scrub/
13
+ rubyforge_project: hpricot_scrub
14
+ description: Scrub HTML with Hpricot
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - UnderpantsGnome
31
+ files:
32
+ - Rakefile
33
+ - README.txt
34
+ - CHANGELOG.txt
35
+ - Manifest.txt
36
+ - setup.rb
37
+ - lib/hpricot_scrub/version.rb
38
+ - lib/hpricot_scrub.rb
39
+ - test/test_helper.rb
40
+ - test/scrubber_data.rb
41
+ - test/hpricot_scrub_test.rb
42
+ - examples/config.yml
43
+ test_files:
44
+ - test/hpricot_scrub_test.rb
45
+ rdoc_options: []
46
+
47
+ extra_rdoc_files: []
48
+
49
+ executables: []
50
+
51
+ extensions: []
52
+
53
+ requirements: []
54
+
55
+ dependencies:
56
+ - !ruby/object:Gem::Dependency
57
+ name: hpricot
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Version::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0.5"
64
+ version: