htmlfilter 1.1 → 1.2.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/.ruby +34 -0
- data/{HISTORY → HISTORY.rdoc} +12 -1
- data/README.rdoc +28 -13
- data/lib/cssfilter.rb +5 -16
- data/lib/htmlfilter.rb +12 -34
- data/test/helper.rb +1 -0
- data/test/test_cssfilter.rb +2 -1
- data/test/test_htmlfilter.rb +2 -0
- metadata +30 -32
- data/MANIFEST +0 -17
- data/Rakefile +0 -15
- data/TODO +0 -5
- data/meta/collection +0 -1
- data/meta/contact +0 -1
- data/meta/description +0 -1
- data/meta/homepage +0 -1
- data/meta/name +0 -1
- data/meta/repository +0 -1
- data/meta/title +0 -1
- data/meta/version +0 -1
data/.ruby
ADDED
@@ -0,0 +1,34 @@
|
|
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
|
10
|
+
conflicts: []
|
11
|
+
|
12
|
+
engine_check: []
|
13
|
+
|
14
|
+
title: HTMLFilter
|
15
|
+
contact: trans <transfire@gmail.com>
|
16
|
+
resources:
|
17
|
+
code: http://github.com/rubyworks/htmlfilter
|
18
|
+
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.
|
33
|
+
summary: HTML/CSS Sanity
|
34
|
+
created: 2009-06-25
|
data/{HISTORY → HISTORY.rdoc}
RENAMED
@@ -1,6 +1,17 @@
|
|
1
1
|
= RELEASE HISTORY
|
2
2
|
|
3
|
-
== 1.
|
3
|
+
== 1.2.0 / 2010-10-13
|
4
|
+
|
5
|
+
Finally removed the lowecase variations on the class names.
|
6
|
+
You must use HTMLFilter now and not HtmlFilter.
|
7
|
+
|
8
|
+
Changes:
|
9
|
+
|
10
|
+
* Remove lowercase variations on class names.
|
11
|
+
* No longer Multiton.
|
12
|
+
|
13
|
+
|
14
|
+
== 1.1.0 / 2009-11-24
|
4
15
|
|
5
16
|
This is release adjusts the names of the classes to
|
6
17
|
be capitialized according to the actual use of the
|
data/README.rdoc
CHANGED
@@ -1,19 +1,24 @@
|
|
1
|
-
=
|
1
|
+
= HTMLFilter
|
2
2
|
|
3
|
-
* http://rubyworks.github.com/htmlfilter
|
4
|
-
* http://github.com/rubyworks/htmlfilter
|
5
3
|
|
6
|
-
==
|
4
|
+
== RESOURCES
|
5
|
+
|
6
|
+
* home: http://rubyworks.github.com/htmlfilter
|
7
|
+
* code: http://github.com/rubyworks/htmlfilter
|
8
|
+
|
9
|
+
|
10
|
+
== DESCRIPTION
|
7
11
|
|
8
12
|
HTML Filter library can be used to sanitize and sterilize
|
9
13
|
HTML. A good idea if you let users submit HTML in comments,
|
10
14
|
for instance.
|
11
15
|
|
12
|
-
This library also include
|
16
|
+
This library also include CSSFilter. The CSSFilter class will
|
13
17
|
clean-up a cascading style sheet. It can be used to remove
|
14
|
-
whitespace and most importantly remove
|
18
|
+
whitespace and most importantly remove URLs.
|
15
19
|
|
16
|
-
|
20
|
+
|
21
|
+
== FEATURES
|
17
22
|
|
18
23
|
* Based on well-worn PHP library.
|
19
24
|
* Regular expression based filtering.
|
@@ -21,25 +26,35 @@ whitespace and most importantly remove urls.
|
|
21
26
|
* Pure-Ruby and no dependencies.
|
22
27
|
* Also has library to clean and compact cascading stylesheets.
|
23
28
|
|
24
|
-
|
29
|
+
|
30
|
+
== SYNOPSIS
|
25
31
|
|
26
32
|
Via the class.
|
27
33
|
|
28
34
|
html = "<<b>hello</b>"
|
29
35
|
|
30
|
-
|
36
|
+
HTMLFilter.new(options).filter(html)
|
31
37
|
|
32
38
|
Or using the String extension.
|
33
39
|
|
34
40
|
html.html_filter(options) #=> "<b>hello</b>"
|
35
41
|
|
36
|
-
See
|
42
|
+
See API documentation for more information.
|
43
|
+
|
44
|
+
|
45
|
+
== INSTALL
|
46
|
+
|
47
|
+
gem install htmlfilter
|
48
|
+
|
49
|
+
|
50
|
+
== DEVELOPMENT
|
51
|
+
|
52
|
+
HTMLFilter is hosted on GitHub[http://github.com/rubyworks/htmlfilter].
|
37
53
|
|
38
|
-
|
54
|
+
HTMLFilter is a RubyWorks[http://rubyworks.github.com] project.
|
39
55
|
|
40
|
-
* sudo gem install htmlfilter
|
41
56
|
|
42
|
-
== LICENSE
|
57
|
+
== LICENSE
|
43
58
|
|
44
59
|
(Creative Commons Attribution-ShareAlike License)
|
45
60
|
|
data/lib/cssfilter.rb
CHANGED
@@ -1,21 +1,10 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# The CSSFilter class will clean up a cascading stylesheet.
|
4
|
-
# It can be used to remove whitespace and most importantly
|
5
|
-
# remove urls.
|
6
|
-
#
|
7
|
-
# == Authors
|
8
|
-
#
|
9
|
-
# * Trans
|
10
|
-
#
|
11
|
-
# == Copying
|
1
|
+
# cssfilter.rb
|
12
2
|
#
|
13
3
|
# Copyright (c) 2007 Thomas Sawyer
|
14
4
|
#
|
15
5
|
# Creative Commons Attribution-ShareAlike 3.0 License
|
16
6
|
#
|
17
|
-
#
|
18
|
-
|
7
|
+
# See http://creativecommons.org/licenses/by-sa/3.0/
|
19
8
|
|
20
9
|
# TODO: Allow urls to be specified per attribute type.
|
21
10
|
|
@@ -30,6 +19,9 @@ require 'uri'
|
|
30
19
|
|
31
20
|
class CSSFilter
|
32
21
|
|
22
|
+
# Library version.
|
23
|
+
VERSION = "1.2.0" # :till: VERSION = <%= version %>
|
24
|
+
|
33
25
|
# should we remove comments? (true, false)
|
34
26
|
attr_accessor :strip_comments
|
35
27
|
|
@@ -225,6 +217,3 @@ class CSSFilter
|
|
225
217
|
|
226
218
|
end
|
227
219
|
|
228
|
-
# For backward compatability. Eventually this will be deprecated.
|
229
|
-
CssFilter = CSSFilter
|
230
|
-
|
data/lib/htmlfilter.rb
CHANGED
@@ -1,43 +1,23 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# HTML Filter library can be used to sanitize and sterilize
|
4
|
-
# HTML. A good idea if you let users submit HTML in comments,
|
5
|
-
# for instance.
|
6
|
-
#
|
7
|
-
# HtmlFilter is a port of lib_filter.php, v1.15 by Cal Henderson <cal@iamcal.com>
|
8
|
-
# licensed under a Creative Commons Attribution-ShareAlike 2.5 License
|
9
|
-
# http://creativecommons.org/licenses/by-sa/2.5/.
|
10
|
-
#
|
11
|
-
# Thanks to Jang Kim for adding support for single quoted attributes.
|
12
|
-
#
|
13
|
-
# == Reference
|
14
|
-
#
|
15
|
-
# * http://iamcal.com/publish/articles/php/processing_html/
|
16
|
-
# * http://iamcal.com/publish/articles/php/processing_html_part_2/
|
17
|
-
#
|
18
|
-
# == Author(s)
|
19
|
-
#
|
20
|
-
# * Trans
|
21
|
-
# * George Moschovitis
|
22
|
-
# * James Britt
|
23
|
-
# * Cal Henderson
|
24
|
-
# * Jang Kim
|
25
|
-
#
|
26
|
-
# == Copying
|
1
|
+
# htmlfilter.rb
|
27
2
|
#
|
28
3
|
# Copyright (c) 2007 Thomas Sawyer
|
29
4
|
#
|
30
5
|
# Creative Commons Attribution-ShareAlike 3.0 License
|
31
6
|
#
|
32
|
-
#
|
33
|
-
|
7
|
+
# See http://creativecommons.org/licenses/by-sa/3.0/
|
8
|
+
#
|
9
|
+
# Thanks to Jang Kim for adding support for single quoted attributes.
|
34
10
|
|
35
|
-
# =
|
11
|
+
# = HTML Filter
|
36
12
|
#
|
37
13
|
# HTML Filter library can be used to sanitize and sterilize
|
38
14
|
# HTML. A good idea if you let users submit HTML in comments,
|
39
15
|
# for instance.
|
40
16
|
#
|
17
|
+
# HtmlFilter is a port of lib_filter.php, v1.15 by Cal Henderson <cal@iamcal.com>
|
18
|
+
# licensed under a Creative Commons Attribution-ShareAlike 2.5 License
|
19
|
+
# http://creativecommons.org/licenses/by-sa/3.0/.
|
20
|
+
#
|
41
21
|
# == Usage
|
42
22
|
#
|
43
23
|
# hf = HTMLFilter.new
|
@@ -55,6 +35,9 @@
|
|
55
35
|
#
|
56
36
|
class HTMLFilter
|
57
37
|
|
38
|
+
# Library version.
|
39
|
+
VERSION = "1.2.0" # :till: VERSION = "<%= version %>"
|
40
|
+
|
58
41
|
# tags and attributes that are allowed
|
59
42
|
#
|
60
43
|
# Eg.
|
@@ -613,8 +596,3 @@ class String
|
|
613
596
|
end
|
614
597
|
end
|
615
598
|
|
616
|
-
# For backward compatability. Eventually this will be deprecated.
|
617
|
-
HtmlFilter = HTMLFilter
|
618
|
-
|
619
|
-
|
620
|
-
|
data/test/helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
$:.unshift './lib'
|
data/test/test_cssfilter.rb
CHANGED
data/test/test_htmlfilter.rb
CHANGED
metadata
CHANGED
@@ -1,77 +1,75 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: htmlfilter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 31
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 1.2.0
|
5
11
|
platform: ruby
|
6
|
-
authors:
|
7
|
-
|
12
|
+
authors:
|
13
|
+
- Thomas Sawyer
|
8
14
|
autorequire:
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
13
|
-
default_executable:
|
18
|
+
date: 2011-05-22 00:00:00 Z
|
14
19
|
dependencies: []
|
15
20
|
|
16
21
|
description: Sanitize and sterilize HTML, also includes a CSS filter.
|
17
|
-
email:
|
22
|
+
email: transfire@gmail.com
|
18
23
|
executables: []
|
19
24
|
|
20
25
|
extensions: []
|
21
26
|
|
22
27
|
extra_rdoc_files:
|
23
|
-
- Rakefile
|
24
|
-
- MANIFEST
|
25
|
-
- TODO
|
26
28
|
- README.rdoc
|
27
|
-
- HISTORY
|
28
29
|
files:
|
30
|
+
- .ruby
|
29
31
|
- lib/cssfilter.rb
|
30
32
|
- lib/htmlfilter.rb
|
31
|
-
-
|
32
|
-
- meta/contact
|
33
|
-
- meta/description
|
34
|
-
- meta/homepage
|
35
|
-
- meta/name
|
36
|
-
- meta/repository
|
37
|
-
- meta/title
|
38
|
-
- meta/version
|
33
|
+
- test/helper.rb
|
39
34
|
- test/test_cssfilter.rb
|
40
35
|
- test/test_htmlfilter.rb
|
41
|
-
-
|
42
|
-
- TODO
|
36
|
+
- HISTORY.rdoc
|
43
37
|
- README.rdoc
|
44
|
-
- HISTORY
|
45
|
-
- MANIFEST
|
46
|
-
has_rdoc: true
|
47
38
|
homepage: http://rubyworks.github.com/htmlfilter
|
48
|
-
licenses:
|
49
|
-
|
39
|
+
licenses:
|
40
|
+
- Attribution-ShareAlike 3.0
|
50
41
|
post_install_message:
|
51
42
|
rdoc_options:
|
52
43
|
- --title
|
53
44
|
- HTMLFilter API
|
45
|
+
- --main
|
46
|
+
- README.rdoc
|
54
47
|
require_paths:
|
55
48
|
- lib
|
56
49
|
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
57
51
|
requirements:
|
58
52
|
- - ">="
|
59
53
|
- !ruby/object:Gem::Version
|
54
|
+
hash: 3
|
55
|
+
segments:
|
56
|
+
- 0
|
60
57
|
version: "0"
|
61
|
-
version:
|
62
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
63
60
|
requirements:
|
64
61
|
- - ">="
|
65
62
|
- !ruby/object:Gem::Version
|
63
|
+
hash: 3
|
64
|
+
segments:
|
65
|
+
- 0
|
66
66
|
version: "0"
|
67
|
-
version:
|
68
67
|
requirements: []
|
69
68
|
|
70
69
|
rubyforge_project: htmlfilter
|
71
|
-
rubygems_version: 1.
|
70
|
+
rubygems_version: 1.8.2
|
72
71
|
signing_key:
|
73
72
|
specification_version: 3
|
74
|
-
summary:
|
75
|
-
test_files:
|
76
|
-
|
77
|
-
- test/test_htmlfilter.rb
|
73
|
+
summary: HTML/CSS Sanity
|
74
|
+
test_files: []
|
75
|
+
|
data/MANIFEST
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
#!mast bin lib meta test [A-Z]*
|
2
|
-
lib/cssfilter.rb
|
3
|
-
lib/htmlfilter.rb
|
4
|
-
meta/collection
|
5
|
-
meta/contact
|
6
|
-
meta/description
|
7
|
-
meta/homepage
|
8
|
-
meta/name
|
9
|
-
meta/repository
|
10
|
-
meta/title
|
11
|
-
meta/version
|
12
|
-
test/test_cssfilter.rb
|
13
|
-
test/test_htmlfilter.rb
|
14
|
-
Rakefile
|
15
|
-
TODO
|
16
|
-
README.rdoc
|
17
|
-
HISTORY
|
data/Rakefile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
|
-
#$: << './lib'
|
4
|
-
#require 'rubygems'
|
5
|
-
#require 'hoe'
|
6
|
-
#require 'htmlfilter'
|
7
|
-
#Hoe.new('htmlfilter', HtmlFilter::VERSION) do |p|
|
8
|
-
# p.rubyforge_name = 'death' # if different than lowercase project name
|
9
|
-
# p.developer('Thomas Sawyer', 'transfire@gmail.com')
|
10
|
-
#end
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
# vim: syntax=Ruby
|
15
|
-
|
data/TODO
DELETED
data/meta/collection
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rubyworks
|
data/meta/contact
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rubyworks-mailinglist@googlegroups.com
|
data/meta/description
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Sanitize and sterilize HTML, also includes a CSS filter.
|
data/meta/homepage
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
http://rubyworks.github.com/htmlfilter
|
data/meta/name
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
htmlfilter
|
data/meta/repository
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
git://github.com/rubyworks/htmlfilter.git
|
data/meta/title
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
HTMLFilter
|
data/meta/version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.1
|