bootstrap-email 1.0.0.alpha3.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75655e6d12a24abed3f9cf4fee65bc198210d1e9289196b8df80bd53791c21b2
4
- data.tar.gz: 365aedf89fa3f0818ecb6808762d75045855e542172d5ad3440cb5c69dbdc748
3
+ metadata.gz: 3fd77db91c7a64e16baf699225f9187894bd92bd87a8c23584c8435e520e8042
4
+ data.tar.gz: 00f9c70ad47a3cafbd4c9663e2932e9efa8b1fc8706e3971a8bf27bc80f0ee93
5
5
  SHA512:
6
- metadata.gz: 80c34ce66af8e2024fa3547a08c1ec4330ddf77c7e25297753edd164b54586f811c19b2722df572f296fa006227b950c0803e7769fc7a523ed4cba0c1bc451d1
7
- data.tar.gz: 38b53f2516bbd1f46fea866b06170174d89333f7d8b44a42bb36d7220af717ae97ab0e9967898ded0544584d120b59bde6d22c78023e562c1254460db6c7c9f0
6
+ metadata.gz: ccc640cbc412e925b1dbf37925ad09b3c6f8e9633dd091fc73e2daa578536401f98938743bb25dbfb21999f5d14e5a63056d23d9fad3f981fc44a25a5b1214d2
7
+ data.tar.gz: 10e8d04cbc16099c20b1193f52cd17b704bcddda74b15e78dabb0ebcd36ebf059b89dd8cc97021a7a451e89b90f6ae80aaaa1f5d018bc33be86c4b0c65ac25f8
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0.alpha3.1
1
+ 1.0.2
@@ -88,6 +88,9 @@ table:not([class^=s-]) {
88
88
  }
89
89
  }
90
90
  }
91
+ .row.row-responsive {
92
+ margin-right: 0 !important;
93
+ }
91
94
 
92
95
  // Stack Gap
93
96
  @each $space, $value in $spacers {
@@ -1,6 +1,6 @@
1
1
  @each $space, $value in $spacers {
2
- table.stack-x.gap-#{$space},
3
- table.stack-x.gap-lg-#{$space} {
2
+ table.stack-row.gap-#{$space},
3
+ table.stack-row.gap-lg-#{$space} {
4
4
  & > tbody > tr > td {
5
5
  padding-right: $value;
6
6
  &:last-child {
@@ -8,8 +8,8 @@
8
8
  }
9
9
  }
10
10
  }
11
- table.stack-y.gap-#{$space},
12
- table.stack-y.gap-lg-#{$space} {
11
+ table.stack-col.gap-#{$space},
12
+ table.stack-col.gap-lg-#{$space} {
13
13
  & > tbody > tr {
14
14
  & > td {
15
15
  padding-bottom: $value;
@@ -27,13 +27,13 @@
27
27
  }
28
28
 
29
29
  @each $align in $vertical-align {
30
- table.stack-valign-#{$align} > tbody > tr > td {
30
+ table.stack-ay-#{$align} > tbody > tr > td {
31
31
  vertical-align: $align;
32
32
  }
33
33
  }
34
34
 
35
35
  @each $align in $text-align {
36
- table.stack-align-#{$align} > tbody > tr > td {
36
+ table.stack-ax-#{$align} > tbody > tr > td {
37
37
  text-align: $align;
38
38
  }
39
39
  }
@@ -1,5 +1,5 @@
1
1
  @each $align in $vertical-align {
2
- @include valign-util('.valign-#{$align}') {
2
+ @include valign-util('.ay-#{$align}') {
3
3
  vertical-align: $align !important;
4
4
  }
5
5
  }
@@ -48,6 +48,8 @@ module BootstrapEmail
48
48
  html,
49
49
  with_html_string: true,
50
50
  preserve_reset: false,
51
+ adapter: :nokogiri_fast,
52
+ output_encoding: 'US-ASCII',
51
53
  css_string: css_string
52
54
  )
53
55
  self.doc = premailer.doc
@@ -82,13 +84,14 @@ module BootstrapEmail
82
84
  end
83
85
 
84
86
  def configure_html!
85
- BootstrapEmail::Converter::ForceEncoding.build(doc)
86
87
  BootstrapEmail::Converter::HeadStyle.build(doc)
87
88
  BootstrapEmail::Converter::VersionComment.build(doc)
88
89
  end
89
90
 
90
91
  def finalize_document!
91
- html = BootstrapEmail::Converter::ForceEncoding.replace(doc.to_html)
92
+ html = doc.to_html(encoding: 'US-ASCII')
93
+ BootstrapEmail::Converter::SupportUrlTokens.replace(html)
94
+ BootstrapEmail::Converter::ForceEncoding.replace(html)
92
95
  case type
93
96
  when :rails
94
97
  (@mail.html_part || @mail).body = html
@@ -3,7 +3,7 @@ module BootstrapEmail
3
3
  class Align < Base
4
4
  def build
5
5
  ['left', 'center', 'right'].each do |type|
6
- full_type = "align-#{type}"
6
+ full_type = "ax-#{type}"
7
7
  each_node(".#{full_type}") do |node|
8
8
  align_helper(node, full_type, type)
9
9
  end
@@ -36,7 +36,7 @@ module BootstrapEmail
36
36
 
37
37
  def add_class(node, class_name)
38
38
  node['class'] ||= ''
39
- node['class'] += node['class'].length.zero? ? class_name : " #{class_name}"
39
+ node['class'] = "#{node['class'].strip} #{class_name}".strip
40
40
  end
41
41
 
42
42
  def margin?(node)
@@ -1,15 +1,13 @@
1
1
  module BootstrapEmail
2
2
  module Converter
3
3
  class ForceEncoding < Base
4
- def build
5
- body = doc.at_css('body')
6
- body.add_child('<force-encoding></force-encoding>')
7
- end
8
-
9
4
  def self.replace(html)
10
5
  # force utf-8 character encoded in iOS Mail: https://github.com/bootstrap-email/bootstrap-email/issues/50
11
- # this needs to be done after the document has been outputted to a string so it doesn't get converted
12
- html.sub('<force-encoding></force-encoding>', '<div id="force-encoding-to-utf-8" style="display: none;">&#10175;</div>')
6
+ # this needs to be done after the document has been outputted to a ascii string so it doesn't get converted
7
+ html.sub!(
8
+ '<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">',
9
+ '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'
10
+ )
13
11
  end
14
12
  end
15
13
  end
@@ -3,6 +3,9 @@ module BootstrapEmail
3
3
  class Grid < Base
4
4
  def build
5
5
  each_node('.row') do |node|
6
+ if node.at("./*[contains(@class, 'col-lg-')]")
7
+ add_class(node, 'row-responsive')
8
+ end
6
9
  node.replace(template('div', classes: node['class'], contents: template('table-to-tr', contents: node.inner_html)))
7
10
  end
8
11
  each_node('*[class*=col]') do |node|
@@ -2,12 +2,12 @@ module BootstrapEmail
2
2
  module Converter
3
3
  class Stack < Base
4
4
  def build
5
- stack_x
6
- stack_y
5
+ stack_row
6
+ stack_col
7
7
  end
8
8
 
9
- def stack_x
10
- each_node('.stack-x') do |node|
9
+ def stack_row
10
+ each_node('.stack-row') do |node|
11
11
  html = ''
12
12
  node.xpath('./*').each do |child|
13
13
  html += template('td', classes: 'stack-cell', contents: child.to_html)
@@ -16,8 +16,8 @@ module BootstrapEmail
16
16
  end
17
17
  end
18
18
 
19
- def stack_y
20
- each_node('.stack-y') do |node|
19
+ def stack_col
20
+ each_node('.stack-col') do |node|
21
21
  html = ''
22
22
  node.xpath('./*').each do |child|
23
23
  html += template('tr', classes: 'stack-cell', contents: child.to_html)
@@ -0,0 +1,17 @@
1
+ module BootstrapEmail
2
+ module Converter
3
+ class SupportUrlTokens < Base
4
+ OPEN_BRACKETS = CGI.escape('{{').freeze
5
+ CLOSE_BRACKETS = CGI.escape('}}').freeze
6
+
7
+ def self.replace(html)
8
+ regex = /((href|src)=(\"|\'))((#{Regexp.quote(OPEN_BRACKETS)}).*?(#{Regexp.quote(CLOSE_BRACKETS)}))(\"|\')/
9
+ if regex.match?(html)
10
+ html.gsub!(regex) do |match|
11
+ "#{$1}#{CGI.unescape($4)}#{$7}"
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -15,7 +15,6 @@ if defined?(Rails)
15
15
  require 'action_mailer'
16
16
  end
17
17
 
18
- require_relative 'bootstrap-email/initialize'
19
18
  require_relative 'bootstrap-email/config'
20
19
  require_relative 'bootstrap-email/setup'
21
20
  require_relative 'bootstrap-email/erb'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-email
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.alpha3.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Yamartino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-14 00:00:00.000000000 Z
11
+ date: 2021-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -126,10 +126,10 @@ files:
126
126
  - lib/bootstrap-email/converters/spacer.rb
127
127
  - lib/bootstrap-email/converters/spacing.rb
128
128
  - lib/bootstrap-email/converters/stack.rb
129
+ - lib/bootstrap-email/converters/support_url_tokens.rb
129
130
  - lib/bootstrap-email/converters/table.rb
130
131
  - lib/bootstrap-email/converters/version_comment.rb
131
132
  - lib/bootstrap-email/erb.rb
132
- - lib/bootstrap-email/initialize.rb
133
133
  - lib/bootstrap-email/rails/action_mailer.rb
134
134
  - lib/bootstrap-email/rails/engine.rb
135
135
  - lib/bootstrap-email/sass_cache.rb
@@ -150,14 +150,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
150
150
  version: '2.0'
151
151
  required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  requirements:
153
- - - ">"
153
+ - - ">="
154
154
  - !ruby/object:Gem::Version
155
- version: 1.3.1
155
+ version: '0'
156
156
  requirements: []
157
157
  rubygems_version: 3.0.3
158
158
  signing_key:
159
159
  specification_version: 4
160
- summary: 'Bootstrap 5 stylesheet, compiler, and inliner for responsive and consistent
160
+ summary: 'Bootstrap 5+ stylesheet, compiler, and inliner for responsive and consistent
161
161
  emails with the Bootstrap syntax you know and love. Support: command line, ruby,
162
162
  rails'
163
163
  test_files: []
@@ -1 +0,0 @@
1
- Premailer::Adapter.use = :nokogiri_fast