bootstrap-email 1.0.0.alpha3.1 → 1.0.2
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/core/bootstrap-head.scss +3 -0
- data/core/scss/components/_stack.scss +6 -6
- data/core/scss/utilities/_valign.scss +1 -1
- data/lib/bootstrap-email/compiler.rb +5 -2
- data/lib/bootstrap-email/converters/align.rb +1 -1
- data/lib/bootstrap-email/converters/base.rb +1 -1
- data/lib/bootstrap-email/converters/force_encoding.rb +5 -7
- data/lib/bootstrap-email/converters/grid.rb +3 -0
- data/lib/bootstrap-email/converters/stack.rb +6 -6
- data/lib/bootstrap-email/converters/support_url_tokens.rb +17 -0
- data/lib/bootstrap-email.rb +0 -1
- metadata +6 -6
- data/lib/bootstrap-email/initialize.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fd77db91c7a64e16baf699225f9187894bd92bd87a8c23584c8435e520e8042
|
4
|
+
data.tar.gz: 00f9c70ad47a3cafbd4c9663e2932e9efa8b1fc8706e3971a8bf27bc80f0ee93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccc640cbc412e925b1dbf37925ad09b3c6f8e9633dd091fc73e2daa578536401f98938743bb25dbfb21999f5d14e5a63056d23d9fad3f981fc44a25a5b1214d2
|
7
|
+
data.tar.gz: 10e8d04cbc16099c20b1193f52cd17b704bcddda74b15e78dabb0ebcd36ebf059b89dd8cc97021a7a451e89b90f6ae80aaaa1f5d018bc33be86c4b0c65ac25f8
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/core/bootstrap-head.scss
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
@each $space, $value in $spacers {
|
2
|
-
table.stack-
|
3
|
-
table.stack-
|
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-
|
12
|
-
table.stack-
|
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-
|
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-
|
36
|
+
table.stack-ax-#{$align} > tbody > tr > td {
|
37
37
|
text-align: $align;
|
38
38
|
}
|
39
39
|
}
|
@@ -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 =
|
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
|
@@ -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(
|
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
|
-
|
6
|
-
|
5
|
+
stack_row
|
6
|
+
stack_col
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
each_node('.stack-
|
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
|
20
|
-
each_node('.stack-
|
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
|
data/lib/bootstrap-email.rb
CHANGED
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.
|
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-
|
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:
|
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
|