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.
- data/CHANGELOG.txt +0 -0
- data/Manifest.txt +11 -0
- data/README.txt +12 -0
- data/Rakefile +54 -0
- data/examples/config.yml +47 -0
- data/lib/hpricot_scrub/version.rb +9 -0
- data/lib/hpricot_scrub.rb +1 -0
- data/setup.rb +1585 -0
- data/test/hpricot_scrub_test.rb +18 -0
- data/test/scrubber_data.rb +12 -0
- data/test/test_helper.rb +2 -0
- metadata +64 -0
data/CHANGELOG.txt
ADDED
File without changes
|
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
README for hpricot_scrub
|
2
|
+
========================
|
3
|
+
|
4
|
+
HpricotScrub is a wrapper around Hpricot that allows you to easily scrub HTML
|
5
|
+
of tags and attributes you don't want in the final output.
|
6
|
+
|
7
|
+
See examples/config.yml for a sample config file or
|
8
|
+
|
9
|
+
http://underpantsgnome.com/2007/01/20/hpricot-scrub/
|
10
|
+
|
11
|
+
for more info.
|
12
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'rubygems'
|
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
|
+
|
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/"
|
20
|
+
|
21
|
+
|
22
|
+
NAME = "hpricot_scrub"
|
23
|
+
REV = nil # UNCOMMENT IF REQUIRED: File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
|
24
|
+
VERS = ENV['VERSION'] || (HpricotScrub::VERSION::STRING + (REV ? ".#{REV}" : ""))
|
25
|
+
CLEAN.include ['**/.*.sw?', '*.gem', '.config']
|
26
|
+
RDOC_OPTS = ['--quiet', '--title', "hpricot_scrub documentation",
|
27
|
+
"--opname", "index.html",
|
28
|
+
"--line-numbers",
|
29
|
+
"--main", "README",
|
30
|
+
"--inline-source"]
|
31
|
+
|
32
|
+
class Hoe
|
33
|
+
def extra_deps
|
34
|
+
@extra_deps.reject { |x| Array(x).first == 'hoe' }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Generate all the Rake tasks
|
39
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
40
|
+
hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
41
|
+
p.author = AUTHOR
|
42
|
+
p.description = DESCRIPTION
|
43
|
+
p.email = EMAIL
|
44
|
+
p.summary = DESCRIPTION
|
45
|
+
p.url = HOMEPATH
|
46
|
+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
47
|
+
p.test_globs = ["test/**/*_test.rb"]
|
48
|
+
p.clean_globs = CLEAN #An array of file patterns to delete on clean.
|
49
|
+
|
50
|
+
# == Optional
|
51
|
+
#p.changes - A description of the release's latest changes.
|
52
|
+
p.extra_deps = ['hpricot', '>= 0.5']
|
53
|
+
#p.spec_extras - A hash of extra values to set in the gemspec.
|
54
|
+
end
|
data/examples/config.yml
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
|
2
|
+
---
|
3
|
+
:allow_tags: # let these tags stay, but will strip attributes
|
4
|
+
- 'b'
|
5
|
+
- 'blockquote'
|
6
|
+
- 'br'
|
7
|
+
- 'div'
|
8
|
+
- 'h1'
|
9
|
+
- 'h2'
|
10
|
+
- 'h3'
|
11
|
+
- 'h4'
|
12
|
+
- 'h5'
|
13
|
+
- 'h6'
|
14
|
+
- 'hr'
|
15
|
+
- 'i'
|
16
|
+
- 'em'
|
17
|
+
- 'img'
|
18
|
+
- 'li'
|
19
|
+
- 'ol'
|
20
|
+
- 'p'
|
21
|
+
- 'pre'
|
22
|
+
- 'small'
|
23
|
+
- 'span'
|
24
|
+
- 'span'
|
25
|
+
- 'strike'
|
26
|
+
- 'strong'
|
27
|
+
- 'sub'
|
28
|
+
- 'sup'
|
29
|
+
- 'table'
|
30
|
+
- 'tbody'
|
31
|
+
- 'td'
|
32
|
+
- 'tfoot'
|
33
|
+
- 'thead'
|
34
|
+
- 'tr'
|
35
|
+
- 'u'
|
36
|
+
- 'ul'
|
37
|
+
|
38
|
+
:remove_tags: # completely removes everything between open and close tag
|
39
|
+
- 'form'
|
40
|
+
- 'script'
|
41
|
+
|
42
|
+
:allow_attributes: # let these attributes stay, strip all others
|
43
|
+
- 'src'
|
44
|
+
- 'font'
|
45
|
+
- 'alt'
|
46
|
+
- 'style'
|
47
|
+
- 'align'
|
@@ -0,0 +1 @@
|
|
1
|
+
Dir[File.join(File.dirname(__FILE__), 'hpricot_scrub/**/*.rb')].sort.each { |lib| require lib }
|