friendly_format 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,7 +1,9 @@
1
1
  = friendly_format changes history
2
2
 
3
- == friendly_format 0.7.0 / 2009-07-31
3
+ == friendly_format 0.7.1 / 2009-08-06
4
+ * filter attribute value start with javascript.
4
5
 
6
+ == friendly_format 0.7.0 / 2009-07-31
5
7
  * no more super long line. added a newline after br tag.
6
8
  * all adapters work nearly the same now.
7
9
  * dropped support for libxml
@@ -13,7 +15,6 @@
13
15
  * now js attrs in allowed tags would be filter out
14
16
 
15
17
  == friendly_format 0.6.1 / 2009-04-05
16
-
17
18
  * added nokogiri and libxml-ruby support.
18
19
  * drop support for hpricot < 0.7
19
20
  * you can explicitly choose adapter, or auto-choose:
@@ -26,11 +27,9 @@
26
27
  * escape gt(>) in pre tag and forbidden tag as well.
27
28
 
28
29
  == friendly_format 0.5.1 / 2008-12-11
29
-
30
30
  * first release to rubyforge
31
31
 
32
32
  == friendly_format 0.5 / 2008-11-05
33
-
34
33
  * 1 major enhancement
35
34
  * Birthday!
36
35
  * extracted from Ludy::XhtmlFormatter!
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{friendly_format}
5
- s.version = "0.7.0"
5
+ s.version = "0.7.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Lin Jen-Shin (aka godfat \347\234\237\345\270\270)"]
9
- s.date = %q{2009-07-31}
9
+ s.date = %q{2009-08-06}
10
10
  s.description = %q{ make user input be valid xhtml and format it with gsub("\n", "<br/>") etc.
11
11
  you can partially allow some tags and don't escape them.}
12
12
  s.email = %q{godfat (XD) godfat.org}
@@ -5,7 +5,6 @@ require 'friendly_format/set_strict'
5
5
 
6
6
  # 2008-05-09 godfat
7
7
  module FriendlyFormat
8
- autoload(:LibxmlAdapter, 'friendly_format/adapter/libxml_adapter')
9
8
  autoload(:HpricotAdapter, 'friendly_format/adapter/hpricot_adapter')
10
9
  autoload(:NokogiriAdapter, 'friendly_format/adapter/nokogiri_adapter')
11
10
 
@@ -15,11 +14,7 @@ module FriendlyFormat
15
14
  @adapter ||= begin
16
15
  HpricotAdapter
17
16
  rescue LoadError
18
- begin
19
- NokogiriAdapter
20
- rescue LoadError
21
- LibxmlAdapter
22
- end
17
+ NokogiriAdapter
23
18
  end
24
19
  end
25
20
  end
@@ -244,7 +239,9 @@ module FriendlyFormat
244
239
  end
245
240
 
246
241
  def node_attrs_reject_js node
247
- attrs2str(node.attributes.reject{ |k, v| k =~ /\Aon/ })
242
+ attrs2str(node.attributes.reject{ |k, v|
243
+ k =~ /\Aon/ ||
244
+ v.to_s =~ /\Ajavascript/ })
248
245
  end
249
246
 
250
247
  def attrs2str attrs
@@ -1,3 +1,3 @@
1
1
  module FriendlyFormat
2
- VERSION = '0.7.0'
2
+ VERSION = '0.7.1'
3
3
  end
@@ -236,6 +236,9 @@ compilation mode. 非常驚人的開發速度。<br />
236
236
 
237
237
  s = '<a href="#" onclick="window.alert(\'attack!\')">js</a>'
238
238
  assert_equal(FriendlyFormat.escape_ltgt(s), format_article(s))
239
+
240
+ s = '<a href="javascript:alert(\'attack!\')">win a wing!</a>'
241
+ assert_equal('<a>win a wing!</a>', format_article(s, :a))
239
242
  end
240
243
  end
241
244
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: friendly_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Lin Jen-Shin (aka godfat \xE7\x9C\x9F\xE5\xB8\xB8)"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-31 00:00:00 +08:00
12
+ date: 2009-08-06 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency