bootstrap-email 1.0.2 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3fd77db91c7a64e16baf699225f9187894bd92bd87a8c23584c8435e520e8042
4
- data.tar.gz: 00f9c70ad47a3cafbd4c9663e2932e9efa8b1fc8706e3971a8bf27bc80f0ee93
3
+ metadata.gz: 4197c0097c9360b43b8a1ede02394b097e5e2f40451d7e3adc47d3147a91f6e8
4
+ data.tar.gz: a79f895885f53be20db9647c21adf5265d7fa7ec95726a07ac3f44645f532f87
5
5
  SHA512:
6
- metadata.gz: ccc640cbc412e925b1dbf37925ad09b3c6f8e9633dd091fc73e2daa578536401f98938743bb25dbfb21999f5d14e5a63056d23d9fad3f981fc44a25a5b1214d2
7
- data.tar.gz: 10e8d04cbc16099c20b1193f52cd17b704bcddda74b15e78dabb0ebcd36ebf059b89dd8cc97021a7a451e89b90f6ae80aaaa1f5d018bc33be86c4b0c65ac25f8
6
+ metadata.gz: 45e2bee1dd5e717b2c5487b215b2281309ce8e4e97d218382927e7450ae99e5512874e42cb6558bc37ec85378d201ad509139e4d200421225c2921ab466635e5
7
+ data.tar.gz: 67eaf18b7351c22cb4970a31c0f6e548f493eacba3e0fd6d3e18f8268ff949a8f70c81cc40f44dc1cc1053b7197b6dfdcdf457e66fe975b1a889f8aab7886a55
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.1.0
@@ -88,7 +88,7 @@ table:not([class^=s-]) {
88
88
  }
89
89
  }
90
90
  }
91
- .row.row-responsive {
91
+ .row-responsive.row {
92
92
  margin-right: 0 !important;
93
93
  }
94
94
 
data/core/layout.html.erb CHANGED
@@ -2,8 +2,8 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <meta name="x-apple-disable-message-reformatting">
6
5
  <meta http-equiv="x-ua-compatible" content="ie=edge">
6
+ <meta name="x-apple-disable-message-reformatting">
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1">
8
8
  <meta name="format-detection" content="telephone=no, date=no, address=no, email=no">
9
9
  </head>
@@ -85,6 +85,7 @@ module BootstrapEmail
85
85
 
86
86
  def configure_html!
87
87
  BootstrapEmail::Converter::HeadStyle.build(doc)
88
+ BootstrapEmail::Converter::AddMissingMetaTags.build(doc)
88
89
  BootstrapEmail::Converter::VersionComment.build(doc)
89
90
  end
90
91
 
@@ -92,6 +93,7 @@ module BootstrapEmail
92
93
  html = doc.to_html(encoding: 'US-ASCII')
93
94
  BootstrapEmail::Converter::SupportUrlTokens.replace(html)
94
95
  BootstrapEmail::Converter::ForceEncoding.replace(html)
96
+ BootstrapEmail::Converter::BeautifyHTML.replace(html)
95
97
  case type
96
98
  when :rails
97
99
  (@mail.html_part || @mail).body = html
@@ -0,0 +1,21 @@
1
+ module BootstrapEmail
2
+ module Converter
3
+ class AddMissingMetaTags < Base
4
+ META_TAGS = [
5
+ {query: 'meta[http-equiv="Content-Type"]' , code: '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'},
6
+ {query: 'meta[http-equiv="x-ua-compatible"]', code: '<meta http-equiv="x-ua-compatible" content="ie=edge">'},
7
+ {query: 'meta[name="x-apple-disable-message-reformatting"]', code: '<meta name="x-apple-disable-message-reformatting">'},
8
+ {query: 'meta[name="viewport"]', code: '<meta name="viewport" content="width=device-width, initial-scale=1">'},
9
+ {query: 'meta[name="format-detection"]', code: '<meta name="format-detection" content="telephone=no, date=no, address=no, email=no">'}
10
+ ].reverse.freeze
11
+
12
+ def build
13
+ META_TAGS.each do |tag_hash|
14
+ unless doc.at_css(tag_hash[:query])
15
+ doc.at_css('head').prepend_child(tag_hash[:code])
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -36,7 +36,8 @@ module BootstrapEmail
36
36
 
37
37
  def add_class(node, class_name)
38
38
  node['class'] ||= ''
39
- node['class'] = "#{node['class'].strip} #{class_name}".strip
39
+ # remove double spaces and strip white space from ends
40
+ node['class'] = "#{node['class']} #{class_name}".gsub(/\s+/, ' ').strip
40
41
  end
41
42
 
42
43
  def margin?(node)
@@ -0,0 +1,10 @@
1
+ module BootstrapEmail
2
+ module Converter
3
+ class BeautifyHTML < Base
4
+ def self.replace(html)
5
+ # Pretty print format the HTML string and add a trailing newline
6
+ html.replace(HtmlBeautifier.beautify(html) + "\n")
7
+ end
8
+ end
9
+ end
10
+ end
@@ -6,6 +6,7 @@ require 'sassc'
6
6
  require 'digest/sha1'
7
7
  require 'css_parser'
8
8
  require 'fileutils'
9
+ require 'htmlbeautifier'
9
10
 
10
11
  begin
11
12
  require 'rails'
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.2
4
+ version: 1.1.0
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-10-16 00:00:00.000000000 Z
11
+ date: 2021-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: htmlbeautifier
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
55
69
  description:
56
70
  email: stu@stuyam.com
57
71
  executables:
@@ -105,10 +119,12 @@ files:
105
119
  - lib/bootstrap-email/bootstrap_email_cli.rb
106
120
  - lib/bootstrap-email/compiler.rb
107
121
  - lib/bootstrap-email/config.rb
122
+ - lib/bootstrap-email/converters/add_missing_meta_tags.rb
108
123
  - lib/bootstrap-email/converters/alert.rb
109
124
  - lib/bootstrap-email/converters/align.rb
110
125
  - lib/bootstrap-email/converters/badge.rb
111
126
  - lib/bootstrap-email/converters/base.rb
127
+ - lib/bootstrap-email/converters/beautify_html.rb
112
128
  - lib/bootstrap-email/converters/block.rb
113
129
  - lib/bootstrap-email/converters/body.rb
114
130
  - lib/bootstrap-email/converters/button.rb