htmlfilter 1.2.0 → 1.2.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/.ruby CHANGED
@@ -1,34 +1,47 @@
1
- ---
2
- spec_version: 1.0.0
3
- replaces: []
4
-
5
- loadpath:
6
- - lib
7
- name: htmlfilter
8
- repositories:
9
- public: git://github.com/rubyworks/htmlfilter.git
1
+ ---
2
+ source:
3
+ - meta
4
+ authors:
5
+ - name: Thomas Sawyer
6
+ email: transfire@gmail.com
7
+ copyrights:
8
+ - holder: Thomas Sawyer, Rubyworks
9
+ year: '2009'
10
+ license: BSD-2-Clause
11
+ replacements: []
12
+ alternatives: []
13
+ requirements:
14
+ - name: detroit
15
+ groups:
16
+ - build
17
+ development: true
18
+ - name: microtest
19
+ groups:
20
+ - test
21
+ development: true
22
+ - name: ae
23
+ groups:
24
+ - test
25
+ development: true
26
+ dependencies: []
10
27
  conflicts: []
11
-
12
- engine_check: []
13
-
14
- title: HTMLFilter
15
- contact: trans <transfire@gmail.com>
16
- resources:
28
+ repositories:
29
+ - uri: git://github.com/rubyworks/htmlfilter.git
30
+ scm: git
31
+ name: upstream
32
+ resources:
33
+ home: http://rubyworks.github.com/htmlfilter
34
+ docs: http://rubydoc.info/gems/htmlfilter
17
35
  code: http://github.com/rubyworks/htmlfilter
18
36
  mail: http://groups.google.com/group/rubyworks-mailinglist
19
- home: http://rubyworks.github.com/htmlfilter
20
- maintainers: []
21
-
22
- requires: []
23
-
24
- manifest: Manifest.txt
25
- version: 1.2.0
26
- licenses:
27
- - Attribution-ShareAlike 3.0
28
- copyright: Copyright (c) 2009 Thomas Sawyer
29
- authors:
30
- - Thomas Sawyer
31
- organization: RubyWorks
32
- description: Sanitize and sterilize HTML, also includes a CSS filter.
37
+ extra: {}
38
+ load_path:
39
+ - lib
40
+ revision: 0
41
+ created: '2009-06-25'
33
42
  summary: HTML/CSS Sanity
34
- created: 2009-06-25
43
+ title: HTMLFilter
44
+ version: 1.2.1
45
+ name: htmlfilter
46
+ description: Sanitize and sterilize HTML, also includes a CSS filter.
47
+ date: '2011-10-26'
data/.yardopts ADDED
@@ -0,0 +1,8 @@
1
+ --title "HTMLFilter"
2
+ --readme README.rdoc
3
+ --protected
4
+ --private
5
+ lib/**/*.rb
6
+ -
7
+ [A-Z]*.*
8
+
data/COPYING.rdoc ADDED
@@ -0,0 +1,41 @@
1
+ = COPYRIGHT NOTICES
2
+
3
+ == HTMLFilter
4
+
5
+ Copyright:: (c) 2009 Thomas Sawyer, Rubyworks
6
+ License: BSD-2-Clause
7
+ Website:: http://rubyworks.github.com/htmlfilter
8
+
9
+ Copyright (c) 2009 Thomas Sawyer, Rubyworks
10
+
11
+ Redistribution and use in source and binary forms, with or without modification, are
12
+ permitted provided that the following conditions are met:
13
+
14
+ 1. Redistributions of source code must retain the above copyright notice, this list of
15
+ conditions and the following disclaimer.
16
+
17
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list
18
+ of conditions and the following disclaimer in the documentation and/or other materials
19
+ provided with the distribution.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY Thomas Sawyer ``AS IS'' AND ANY EXPRESS OR IMPLIED
22
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
23
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Thomas Sawyer OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+
32
+ == lib_filter.php
33
+
34
+ Copyright:: (c) 2007 Cal Henderson
35
+ License: CC-BY-SA
36
+ Website:: http://code.iamcal.com/php/lib_filter/
37
+
38
+ HtmlFilter is a port of lib_filter.php, v1.15 by Cal Henderson <cal@iamcal.com>
39
+ licensed under a Creative Commons Attribution-ShareAlike 2.5 License
40
+
41
+ http://creativecommons.org/licenses/by-sa/3.0/.Attribution-ShareAlike 3.0
data/HISTORY.rdoc CHANGED
@@ -1,8 +1,18 @@
1
1
  = RELEASE HISTORY
2
2
 
3
- == 1.2.0 / 2010-10-13
3
+ == 1.2.1 | 2011-10-26
4
4
 
5
- Finally removed the lowecase variations on the class names.
5
+ This release is simply a maintenance release to bring the
6
+ projects build configuration up to date.
7
+
8
+ Changes:
9
+
10
+ * Modernize build configuration.
11
+
12
+
13
+ == 1.2.0 | 2010-10-13
14
+
15
+ Finally removed the lowercase variations on the class names.
6
16
  You must use HTMLFilter now and not HtmlFilter.
7
17
 
8
18
  Changes:
@@ -11,7 +21,7 @@ Changes:
11
21
  * No longer Multiton.
12
22
 
13
23
 
14
- == 1.1.0 / 2009-11-24
24
+ == 1.1.0 | 2009-11-24
15
25
 
16
26
  This is release adjusts the names of the classes to
17
27
  be capitialized according to the actual use of the
@@ -28,7 +38,7 @@ Changes:
28
38
  * Added built-in option constants.
29
39
  * CssTree is now CSSFilter::Tree.
30
40
 
31
- == 1.0.0 / 2009-06-25
41
+ == 1.0.0 | 2009-06-25
32
42
 
33
43
  Changes:
34
44
 
data/README.rdoc CHANGED
@@ -3,8 +3,8 @@
3
3
 
4
4
  == RESOURCES
5
5
 
6
- * home: http://rubyworks.github.com/htmlfilter
7
- * code: http://github.com/rubyworks/htmlfilter
6
+ * {Website}[http://rubyworks.github.com/htmlfilter]
7
+ * {Source Code}[http://github.com/rubyworks/htmlfilter]
8
8
 
9
9
 
10
10
  == DESCRIPTION
@@ -31,7 +31,7 @@ whitespace and most importantly remove URLs.
31
31
 
32
32
  Via the class.
33
33
 
34
- html = "<<b>hello</b>"
34
+ html = "<b>hello</b>"
35
35
 
36
36
  HTMLFilter.new(options).filter(html)
37
37
 
@@ -44,25 +44,29 @@ See API documentation for more information.
44
44
 
45
45
  == INSTALL
46
46
 
47
- gem install htmlfilter
47
+ $ gem install htmlfilter
48
48
 
49
49
 
50
50
  == DEVELOPMENT
51
51
 
52
52
  HTMLFilter is hosted on GitHub[http://github.com/rubyworks/htmlfilter].
53
53
 
54
- HTMLFilter is a RubyWorks[http://rubyworks.github.com] project.
54
+ HTMLFilter is a Rubyworks[http://rubyworks.github.com] project.
55
55
 
56
56
 
57
- == LICENSE
57
+ == ACKNOWLEDGEMENTS
58
58
 
59
- (Creative Commons Attribution-ShareAlike License)
60
-
61
- Copyright (c) 2009 Thomas Sawyer
62
-
63
- See http://creativecommons.org/licenses/by-sa/3.0/deed.en
59
+ Thanks to Jang Kim for adding support for single quoted attributes.
64
60
 
65
61
  HtmlFilter is a port of lib_filter.php, v1.15 by Cal Henderson <cal@iamcal.com>.
66
62
  This code is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
67
63
  See http://creativecommons.org/licenses/by-sa/2.5/.
68
64
 
65
+
66
+ == COPYRIGHTS
67
+
68
+ Copyright (c) 2009 Thomas Sawyer, Rubyworks (BSD-2)
69
+
70
+ Copyright (c) 2007 Cal Henderson (CC-BY-SA)
71
+
72
+ See COPYING.rdoc for details.
data/lib/cssfilter.rb CHANGED
@@ -1,13 +1,3 @@
1
- # cssfilter.rb
2
- #
3
- # Copyright (c) 2007 Thomas Sawyer
4
- #
5
- # Creative Commons Attribution-ShareAlike 3.0 License
6
- #
7
- # See http://creativecommons.org/licenses/by-sa/3.0/
8
-
9
- # TODO: Allow urls to be specified per attribute type.
10
-
11
1
  #require 'htmlfilter/uri'
12
2
  require 'uri'
13
3
 
@@ -16,6 +6,18 @@ require 'uri'
16
6
  # The CSSFilter class will clean up a cascading style sheet.
17
7
  # It can be used to remove whitespace and most importantly
18
8
  # remove urls.
9
+ #
10
+ # == Issues
11
+ #
12
+ # TODO: Allow urls to be specified per attribute type.
13
+ #
14
+ # == Copying
15
+ #
16
+ # Copyright (c) 2007 Thomas Sawyer
17
+ #
18
+ # Creative Commons Attribution-ShareAlike 3.0 License
19
+ #
20
+ # See http://creativecommons.org/licenses/by-sa/3.0/
19
21
 
20
22
  class CSSFilter
21
23
 
data/lib/htmlfilter.rb CHANGED
@@ -1,13 +1,3 @@
1
- # htmlfilter.rb
2
- #
3
- # Copyright (c) 2007 Thomas Sawyer
4
- #
5
- # Creative Commons Attribution-ShareAlike 3.0 License
6
- #
7
- # See http://creativecommons.org/licenses/by-sa/3.0/
8
- #
9
- # Thanks to Jang Kim for adding support for single quoted attributes.
10
-
11
1
  # = HTML Filter
12
2
  #
13
3
  # HTML Filter library can be used to sanitize and sterilize
@@ -30,9 +20,14 @@
30
20
  #
31
21
  # == Issues
32
22
  #
33
- # * The built in option constants could use a fair bit of refinement.
34
- # * Eventually the old HtmlFilter name needs to be deprecated.
23
+ # * The built in option constants could use some refinement.
35
24
  #
25
+ # == Copying
26
+ #
27
+ # Copyright (c) 2009 Thomas Sawyer, Rubyworks (BSD-2-Clause)
28
+ #
29
+ # Thanks to Jang Kim for adding support for single quoted attributes.
30
+
36
31
  class HTMLFilter
37
32
 
38
33
  # Library version.
@@ -185,7 +180,7 @@ class HTMLFilter
185
180
  end
186
181
 
187
182
  # Filter html string.
188
-
183
+ #
189
184
  def filter(html)
190
185
  @tag_counts = {}
191
186
  html = escape_comments(html)
data/test/helper.rb CHANGED
@@ -1 +1,5 @@
1
1
  $:.unshift './lib'
2
+
3
+ require 'microtest'
4
+ require 'ae'
5
+
@@ -1,9 +1,8 @@
1
- require File.expand_path(File.dirname(__FILE__)) + '/helper.rb'
1
+ require './test/helper.rb'
2
2
 
3
- require "test/unit"
4
3
  require "cssfilter"
5
4
 
6
- class TestCSSFilter < Test::Unit::TestCase
5
+ class TestCSSFilter < MicroTest::TestCase
7
6
 
8
7
  def setup
9
8
  @css = <<-END
@@ -29,7 +28,8 @@ class TestCSSFilter < Test::Unit::TestCase
29
28
  def test_filter
30
29
  cssfilter = CSSFilter.new(:allowed_hosts=>["here.org"], :strip_whitespace => true)
31
30
  csstree = cssfilter.filter(@css)
32
- assert_equal(@result, csstree.to_s)
31
+
32
+ csstree.to_s.assert == @result
33
33
  end
34
34
 
35
35
  end
@@ -1,22 +1,21 @@
1
- require File.expand_path(File.dirname(__FILE__)) + '/helper.rb'
1
+ require './test/helper.rb'
2
2
 
3
- require "test/unit"
4
3
  require "htmlfilter"
5
4
 
6
- class TestHTMLFilter < Test::Unit::TestCase
5
+ class TestHTMLFilter < MicroTest::TestCase
7
6
 
8
7
  # core tests
9
8
 
10
9
  def test_strip_single
11
10
  hf = HTMLFilter.new
12
- assert_equal( '"', hf.send(:strip_single,'\"') )
13
- assert_equal( "\000", hf.send(:strip_single,'\0') )
11
+ hf.send(:strip_single,'\"').assert == '"'
12
+ hf.send(:strip_single,'\0').assert == "\000"
14
13
  end
15
14
 
16
15
  # functional tests
17
16
 
18
17
  def assert_filter(filtered, original)
19
- assert_equal(filtered, original.html_filter)
18
+ original.html_filter.assert == filtered
20
19
  end
21
20
 
22
21
  def test_fix_quotes
metadata CHANGED
@@ -1,33 +1,61 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: htmlfilter
3
- version: !ruby/object:Gem::Version
4
- hash: 31
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.1
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 2
9
- - 0
10
- version: 1.2.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Thomas Sawyer
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-05-22 00:00:00 Z
19
- dependencies: []
20
-
12
+ date: 2011-10-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: detroit
16
+ requirement: &19891580 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *19891580
25
+ - !ruby/object:Gem::Dependency
26
+ name: microtest
27
+ requirement: &19891020 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *19891020
36
+ - !ruby/object:Gem::Dependency
37
+ name: ae
38
+ requirement: &19890500 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *19890500
21
47
  description: Sanitize and sterilize HTML, also includes a CSS filter.
22
- email: transfire@gmail.com
48
+ email:
49
+ - transfire@gmail.com
23
50
  executables: []
24
-
25
51
  extensions: []
26
-
27
- extra_rdoc_files:
52
+ extra_rdoc_files:
53
+ - HISTORY.rdoc
28
54
  - README.rdoc
29
- files:
55
+ - COPYING.rdoc
56
+ files:
30
57
  - .ruby
58
+ - .yardopts
31
59
  - lib/cssfilter.rb
32
60
  - lib/htmlfilter.rb
33
61
  - test/helper.rb
@@ -35,41 +63,30 @@ files:
35
63
  - test/test_htmlfilter.rb
36
64
  - HISTORY.rdoc
37
65
  - README.rdoc
66
+ - COPYING.rdoc
38
67
  homepage: http://rubyworks.github.com/htmlfilter
39
- licenses:
40
- - Attribution-ShareAlike 3.0
68
+ licenses:
69
+ - BSD-2-Clause
41
70
  post_install_message:
42
- rdoc_options:
43
- - --title
44
- - HTMLFilter API
45
- - --main
46
- - README.rdoc
47
- require_paths:
71
+ rdoc_options: []
72
+ require_paths:
48
73
  - lib
49
- required_ruby_version: !ruby/object:Gem::Requirement
74
+ required_ruby_version: !ruby/object:Gem::Requirement
50
75
  none: false
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- hash: 3
55
- segments:
56
- - 0
57
- version: "0"
58
- required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
81
  none: false
60
- requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- hash: 3
64
- segments:
65
- - 0
66
- version: "0"
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
67
86
  requirements: []
68
-
69
- rubyforge_project: htmlfilter
70
- rubygems_version: 1.8.2
87
+ rubyforge_project:
88
+ rubygems_version: 1.8.10
71
89
  signing_key:
72
90
  specification_version: 3
73
91
  summary: HTML/CSS Sanity
74
92
  test_files: []
75
-