packrat 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -13,8 +13,8 @@ begin
13
13
  gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
14
  gem.add_dependency('hpricot', '>= 0.6')
15
15
  gem.add_dependency('css_parser', '>= 0.9.1')
16
- gem.add_dependency('htmlentities', '>= 4.0.0')
17
- gem.add_dependency('text-reform', '>= 0.2.0')
16
+ # gem.add_dependency('htmlentities', '>= 4.0.0')
17
+ # gem.add_dependency('text-reform', '>= 0.2.0')
18
18
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
19
19
  end
20
20
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -1,74 +1,74 @@
1
- require 'text/reform'
2
- require 'htmlentities'
3
-
4
- # Support functions for Premailer
5
- module HtmlToPlainText
6
-
7
- # Returns the text in UTF-8 format with all HTML tags removed
8
- #
9
- # TODO:
10
- # - add support for DL, OL
11
- def convert_to_text(html, line_length = 65, from_charset = 'UTF-8')
12
- r = Text::Reform.new(:trim => true,
13
- :squeeze => false,
14
- :break => Text::Reform.break_wrap)
15
-
16
- txt = html
17
-
18
- # decode HTML entities
19
- he = HTMLEntities.new
20
- txt = he.decode(txt)
21
-
22
- # handle headings (H1-H6)
23
- txt.gsub!(/[ \t]*<h([0-9]+)[^>]*>(.*)<\/h[0-9]+>/i) do |s|
24
- hlevel = $1.to_i
25
- # cleanup text inside of headings
26
- htext = $2.gsub(/<\/?[^>]*>/i, '').strip
27
- hlength = (htext.length > line_length ?
28
- line_length :
29
- htext.length)
30
-
31
- case hlevel
32
- when 1 # H1, asterisks above and below
33
- ('*' * hlength) + "\n" + htext + "\n" + ('*' * hlength) + "\n"
34
- when 2 # H1, dashes above and below
35
- ('-' * hlength) + "\n" + htext + "\n" + ('-' * hlength) + "\n"
36
- else # H3-H6, dashes below
37
- htext + "\n" + ('-' * htext.length) + "\n"
38
- end
39
- end
40
-
41
- # links
42
- txt.gsub!(/<a.*href=\"([^\"]*)\"[^>]*>(.*)<\/a>/i) do |s|
43
- $2.strip + ' ( ' + $1.strip + ' )'
44
- end
45
-
46
- # lists -- TODO: should handle ordered lists
47
- txt.gsub!(/[\s]*(<li[^>]*>)[\s]*/i, '* ')
48
- # list not followed by a newline
49
- txt.gsub!(/<\/li>[\s]*(?![\n])/i, "\n")
50
-
51
- # paragraphs and line breaks
52
- txt.gsub!(/<\/p>/i, "\n\n")
53
- txt.gsub!(/<br[\/ ]*>/i, "\n")
54
-
55
- # strip remaining tags
56
- txt.gsub!(/<\/?[^>]*>/, '')
57
-
58
- # wrap text
59
- txt = r.format(('[' * line_length), txt)
60
-
61
- # remove linefeeds (\r\n and \r -> \n)
62
- txt.gsub!(/\r\n?/, "\n")
63
-
64
- # strip extra spaces
65
- txt.gsub!(/\302\240+/, " ") # non-breaking spaces -> spaces
66
- txt.gsub!(/\n[ \t]+/, "\n") # space at start of lines
67
- txt.gsub!(/[ \t]+\n/, "\n") # space at end of lines
68
-
69
- # no more than two consecutive newlines
70
- txt.gsub!(/[\n]{3,}/, "\n\n")
71
-
72
- txt.strip
73
- end
74
- end
1
+ # require 'text/reform'
2
+ # require 'htmlentities'
3
+ #
4
+ # # Support functions for Premailer
5
+ # module HtmlToPlainText
6
+ #
7
+ # # Returns the text in UTF-8 format with all HTML tags removed
8
+ # #
9
+ # # TODO:
10
+ # # - add support for DL, OL
11
+ # def convert_to_text(html, line_length = 65, from_charset = 'UTF-8')
12
+ # r = Text::Reform.new(:trim => true,
13
+ # :squeeze => false,
14
+ # :break => Text::Reform.break_wrap)
15
+ #
16
+ # txt = html
17
+ #
18
+ # # decode HTML entities
19
+ # he = HTMLEntities.new
20
+ # txt = he.decode(txt)
21
+ #
22
+ # # handle headings (H1-H6)
23
+ # txt.gsub!(/[ \t]*<h([0-9]+)[^>]*>(.*)<\/h[0-9]+>/i) do |s|
24
+ # hlevel = $1.to_i
25
+ # # cleanup text inside of headings
26
+ # htext = $2.gsub(/<\/?[^>]*>/i, '').strip
27
+ # hlength = (htext.length > line_length ?
28
+ # line_length :
29
+ # htext.length)
30
+ #
31
+ # case hlevel
32
+ # when 1 # H1, asterisks above and below
33
+ # ('*' * hlength) + "\n" + htext + "\n" + ('*' * hlength) + "\n"
34
+ # when 2 # H1, dashes above and below
35
+ # ('-' * hlength) + "\n" + htext + "\n" + ('-' * hlength) + "\n"
36
+ # else # H3-H6, dashes below
37
+ # htext + "\n" + ('-' * htext.length) + "\n"
38
+ # end
39
+ # end
40
+ #
41
+ # # links
42
+ # txt.gsub!(/<a.*href=\"([^\"]*)\"[^>]*>(.*)<\/a>/i) do |s|
43
+ # $2.strip + ' ( ' + $1.strip + ' )'
44
+ # end
45
+ #
46
+ # # lists -- TODO: should handle ordered lists
47
+ # txt.gsub!(/[\s]*(<li[^>]*>)[\s]*/i, '* ')
48
+ # # list not followed by a newline
49
+ # txt.gsub!(/<\/li>[\s]*(?![\n])/i, "\n")
50
+ #
51
+ # # paragraphs and line breaks
52
+ # txt.gsub!(/<\/p>/i, "\n\n")
53
+ # txt.gsub!(/<br[\/ ]*>/i, "\n")
54
+ #
55
+ # # strip remaining tags
56
+ # txt.gsub!(/<\/?[^>]*>/, '')
57
+ #
58
+ # # wrap text
59
+ # txt = r.format(('[' * line_length), txt)
60
+ #
61
+ # # remove linefeeds (\r\n and \r -> \n)
62
+ # txt.gsub!(/\r\n?/, "\n")
63
+ #
64
+ # # strip extra spaces
65
+ # txt.gsub!(/\302\240+/, " ") # non-breaking spaces -> spaces
66
+ # txt.gsub!(/\n[ \t]+/, "\n") # space at start of lines
67
+ # txt.gsub!(/[ \t]+\n/, "\n") # space at end of lines
68
+ #
69
+ # # no more than two consecutive newlines
70
+ # txt.gsub!(/[\n]{3,}/, "\n\n")
71
+ #
72
+ # txt.strip
73
+ # end
74
+ # end
@@ -30,7 +30,7 @@
30
30
  # premailer = Premailer.new(html_file, :warn_level => Premailer::Warnings::SAFE)
31
31
  # puts premailer.to_inline_css
32
32
  class Premailer
33
- include HtmlToPlainText
33
+ # include HtmlToPlainText
34
34
  include CssParser
35
35
 
36
36
  VERSION = '1.5.4'
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{packrat}
8
- s.version = "0.1.5"
8
+ s.version = "0.1.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mike Hansen"]
12
- s.date = %q{2010-10-20}
12
+ s.date = %q{2010-10-21}
13
13
  s.description = %q{Packrat is a gem for merging all css rules to inline for html emails and files.}
14
14
  s.email = %q{indyjones805@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -50,21 +50,15 @@ Gem::Specification.new do |s|
50
50
  s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
51
51
  s.add_runtime_dependency(%q<hpricot>, [">= 0.6"])
52
52
  s.add_runtime_dependency(%q<css_parser>, [">= 0.9.1"])
53
- s.add_runtime_dependency(%q<htmlentities>, [">= 4.0.0"])
54
- s.add_runtime_dependency(%q<text-reform>, [">= 0.2.0"])
55
53
  else
56
54
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
57
55
  s.add_dependency(%q<hpricot>, [">= 0.6"])
58
56
  s.add_dependency(%q<css_parser>, [">= 0.9.1"])
59
- s.add_dependency(%q<htmlentities>, [">= 4.0.0"])
60
- s.add_dependency(%q<text-reform>, [">= 0.2.0"])
61
57
  end
62
58
  else
63
59
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
64
60
  s.add_dependency(%q<hpricot>, [">= 0.6"])
65
61
  s.add_dependency(%q<css_parser>, [">= 0.9.1"])
66
- s.add_dependency(%q<htmlentities>, [">= 4.0.0"])
67
- s.add_dependency(%q<text-reform>, [">= 0.2.0"])
68
62
  end
69
63
  end
70
64
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 5
9
- version: 0.1.5
8
+ - 6
9
+ version: 0.1.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mike Hansen
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-20 00:00:00 -05:00
17
+ date: 2010-10-21 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -56,34 +56,6 @@ dependencies:
56
56
  version: 0.9.1
57
57
  type: :runtime
58
58
  version_requirements: *id003
59
- - !ruby/object:Gem::Dependency
60
- name: htmlentities
61
- prerelease: false
62
- requirement: &id004 !ruby/object:Gem::Requirement
63
- requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- segments:
67
- - 4
68
- - 0
69
- - 0
70
- version: 4.0.0
71
- type: :runtime
72
- version_requirements: *id004
73
- - !ruby/object:Gem::Dependency
74
- name: text-reform
75
- prerelease: false
76
- requirement: &id005 !ruby/object:Gem::Requirement
77
- requirements:
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- segments:
81
- - 0
82
- - 2
83
- - 0
84
- version: 0.2.0
85
- type: :runtime
86
- version_requirements: *id005
87
59
  description: Packrat is a gem for merging all css rules to inline for html emails and files.
88
60
  email: indyjones805@gmail.com
89
61
  executables: []