galakei 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- galakei (0.9.0)
4
+ galakei (0.9.1)
5
5
  actionpack (>= 3.0.3)
6
6
  css_parser
7
7
  nokogiri
data/lib/galakei/email.rb CHANGED
@@ -10,9 +10,14 @@ module Galakei::Email
10
10
  /^.+@emnet\.ne\.jp$/,
11
11
  /^.+@docomo\.ne\.jp$/ ]
12
12
 
13
- SANITIZE_OPTIONS = {
14
- :elements => %w{br a div hr},
15
- :attributes => {'a' => ['href'] },
13
+ SANITIZE_OPTIONS = {
14
+ :elements => %w{font blink marquee br a div hr},
15
+ :attributes => {'a' => ['href'],
16
+ 'font' => ['size','color'],
17
+ 'marquee' => ['behaviour'],
18
+ 'hr' => ['color'],
19
+ 'div' => ['align'],
20
+ },
16
21
  :protocols => {'a' => {'href' => ['http', 'https', 'mailto']}},
17
22
  :whitespace_elements => []
18
23
  }
@@ -29,9 +34,9 @@ module Galakei::Email
29
34
  node.name = "div"
30
35
  node.after("<br />")
31
36
  end
32
-
37
+ encoding = doc.meta_encoding || "UTF-8"
33
38
  res = "<html><head>"
34
- res << "<meta http-equiv=\"Content-type\" content=\"text/html;charset=#{doc.meta_encoding}\" />"
39
+ res << "<meta http-equiv=\"Content-type\" content=\"text/html;charset=#{encoding}\" />"
35
40
  res << "</head><body>"
36
41
  res << Sanitize.clean(doc.to_s, SANITIZE_OPTIONS)
37
42
  res << "</body></html>"
@@ -1,3 +1,3 @@
1
1
  module Galakei
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
@@ -29,8 +29,13 @@ describe Galakei::Email do
29
29
  end
30
30
 
31
31
  it "should have div,href,br,hr elements" do
32
- html_email='<div><a href="http://dragonmobile.nuancemobiledeveloper.com/"><img src="http://www.mobilemonday.jp/wp-content/uploads/2011/01/NMDP.jpg" alt=""></a></div><hr> <br><div class="register_button"><a href="http://gigs.checkin.local:3000/events/2/tickets/new?auth_token=demo">Register</a></div>'
33
- Galakei::Email.to_galakei_email(html_email).should =~ /div(.*)href(.*)hr(.*)br/m
32
+ html_email='<div align="center"><a href="http://dragonmobile.nuancemobiledeveloper.com/"><img src="http://www.mobilemonday.jp/wp-content/uploads/2011/01/NMDP.jpg" alt=""></a></div><hr color="blue"> <br><div class="register_button"><a href="http://gigs.checkin.local:3000/events/2/tickets/new?auth_token=demo">Register</a></div>'
33
+ Galakei::Email.to_galakei_email(html_email).should =~ /div(.*)align(.*)href(.*)hr(.*)blue(.*)br/m
34
+ end
35
+
36
+ it "should allow font, blink and marquee elements" do
37
+ html_email='<div align="center"><font size="2" color="red">NEWS FLASH</font><blink>plink plink plink the nineties!</blink><marquee behaviour="scroll">This is corn!</marquee></div>'
38
+ Galakei::Email.to_galakei_email(html_email).should =~ /font(.*)size(.*)color(.*)blink(.*)marquee(.*)behaviour/m
34
39
  end
35
40
 
36
41
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: galakei
3
3
  version: !ruby/object:Gem::Version
4
- hash: 59
4
+ hash: 57
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 0
10
- version: 0.9.0
9
+ - 1
10
+ version: 0.9.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Paul McMahon
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-08-29 00:00:00 Z
20
+ date: 2011-08-30 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: actionpack