mjml-rb 0.3.5 → 0.3.7
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/README.md +10 -13
- data/lib/mjml-rb/components/carousel_image.rb +2 -13
- data/lib/mjml-rb/components/social.rb +10 -16
- data/lib/mjml-rb/version.rb +1 -1
- data/mjml-rb.gemspec +2 -2
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 414eb19865bc6fe6432e0ed0576001365e2c7fcc9e6133005bf4f4cefc89f35b
|
|
4
|
+
data.tar.gz: 420df02142daf9807af8fa96d2ad0ca5ca13f68ffa737781c4c38a85c176d29b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 77e7e40b344e0560b75ec58d1a5e0364f2b8c148f985cba18c77cc678114381416157709db251ef6e3762886a286b2da2d8bb7e38cbfaed07006ed9161c1d0fe
|
|
7
|
+
data.tar.gz: 2511e7880dcb3dccb36dd97228f1e49b9384b0e2f31ed0c51b91db1287d56bd9c5a40f81637dc30cfb783fbd743129523fffcb93e19cab220227f3e6cd836745
|
data/README.md
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
# MJML Ruby Implementation
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
>
|
|
5
|
-
>
|
|
6
|
-
>
|
|
7
|
-
>
|
|
8
|
-
>
|
|
9
|
-
>
|
|
10
|
-
>
|
|
11
|
-
> This is a **fully open source project**, and help is welcome:
|
|
12
|
-
> feedback, bug reports, test cases, optimizations, proposals, and pull requests.
|
|
13
|
-
> No warranty of any kind is provided.
|
|
3
|
+
> **Note:** This is an unofficial Ruby port of the MJML email framework,
|
|
4
|
+
> not affiliated with or endorsed by the MJML team.
|
|
5
|
+
> All 22 MJML v4 components are implemented and tested against npm MJML v4.18.0.
|
|
6
|
+
> Output may differ from the npm renderer in cosmetic ways (whitespace, attribute ordering)
|
|
7
|
+
> but renders identically across email clients.
|
|
8
|
+
> We recommend testing your templates when migrating from the npm renderer.
|
|
9
|
+
> This is a **fully open source project** — feedback, bug reports, test cases,
|
|
10
|
+
> and pull requests are welcome!
|
|
14
11
|
|
|
15
12
|
This gem provides a Ruby-first implementation of the main MJML tooling:
|
|
16
13
|
|
|
@@ -20,6 +17,8 @@ This gem provides a Ruby-first implementation of the main MJML tooling:
|
|
|
20
17
|
- pure Ruby parser, AST, validator, and renderer
|
|
21
18
|
- no Node.js runtime and no shelling out to the official npm renderer
|
|
22
19
|
|
|
20
|
+
Remaining parity work is tracked in [npm ↔ Ruby Parity Audit](docs/PARITY_AUDIT.md).
|
|
21
|
+
|
|
23
22
|
## Compatibility
|
|
24
23
|
|
|
25
24
|
This project targets **MJML v4 only**.
|
|
@@ -205,5 +204,3 @@ If you want the full internal walkthrough, see [docs/ARCHITECTURE.md](docs/ARCHI
|
|
|
205
204
|
> plain Ruby project and render MJML templates the same way you render ERB — no
|
|
206
205
|
> extra runtime, no
|
|
207
206
|
> `package.json`, no `node_modules`.
|
|
208
|
-
|
|
209
|
-
Remaining parity work is tracked in [npm ↔ Ruby Parity Audit](docs/PARITY_AUDIT.md).
|
|
@@ -92,7 +92,7 @@ module MjmlRb
|
|
|
92
92
|
<<~HTML.chomp
|
|
93
93
|
<a#{html_attrs(link_attrs)}>
|
|
94
94
|
<label#{html_attrs(label_attrs)}>
|
|
95
|
-
#{
|
|
95
|
+
<img#{html_attrs(image_attrs)} />
|
|
96
96
|
</label>
|
|
97
97
|
</a>
|
|
98
98
|
HTML
|
|
@@ -117,7 +117,7 @@ module MjmlRb
|
|
|
117
117
|
"width" => container_width.to_i.to_s,
|
|
118
118
|
"border" => "0"
|
|
119
119
|
}
|
|
120
|
-
image_tag =
|
|
120
|
+
image_tag = "<img#{html_attrs(img_attrs)} />"
|
|
121
121
|
|
|
122
122
|
content = if a["href"]
|
|
123
123
|
link_attrs = {
|
|
@@ -146,17 +146,6 @@ module MjmlRb
|
|
|
146
146
|
classes.split(/\s+/).map { |klass| "#{klass}-#{suffix}" }.join(" ")
|
|
147
147
|
end
|
|
148
148
|
|
|
149
|
-
def build_img_tag(attrs)
|
|
150
|
-
ordered_keys = %w[title src alt style width border]
|
|
151
|
-
rendered = ordered_keys.filter_map do |key|
|
|
152
|
-
next unless attrs.key?(key)
|
|
153
|
-
next if attrs[key].nil?
|
|
154
|
-
|
|
155
|
-
%(#{key}="#{escape_attr(attrs[key].to_s)}")
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
"<img #{rendered.join(' ')} />"
|
|
159
|
-
end
|
|
160
149
|
end
|
|
161
150
|
end
|
|
162
151
|
end
|
|
@@ -304,11 +304,16 @@ module MjmlRb
|
|
|
304
304
|
"display" => "block"
|
|
305
305
|
)
|
|
306
306
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
307
|
+
img_attrs = {
|
|
308
|
+
"alt" => alt_val,
|
|
309
|
+
"title" => title_val,
|
|
310
|
+
"src" => src,
|
|
311
|
+
"style" => img_style.empty? ? nil : img_style,
|
|
312
|
+
"width" => icon_width,
|
|
313
|
+
"sizes" => sizes_attr,
|
|
314
|
+
"srcset" => srcset
|
|
315
|
+
}
|
|
316
|
+
img_tag = "<img#{html_attrs(img_attrs)} />"
|
|
312
317
|
|
|
313
318
|
if has_link
|
|
314
319
|
link_attrs_str = html_attrs({ "href" => final_href, "rel" => rel_val, "target" => target_val })
|
|
@@ -360,17 +365,6 @@ module MjmlRb
|
|
|
360
365
|
%(<tr#{tr_class}>#{cells}</tr>)
|
|
361
366
|
end
|
|
362
367
|
|
|
363
|
-
# Build an <img> tag — nil attributes are omitted, empty strings preserved.
|
|
364
|
-
def build_img_tag(alt:, title:, src:, style:, width:, sizes:, srcset:)
|
|
365
|
-
parts = [%( alt="#{escape_attr(alt.to_s)}")]
|
|
366
|
-
parts << %( title="#{escape_attr(title)}") unless title.nil?
|
|
367
|
-
parts << %( src="#{escape_attr(src)}") unless src.nil?
|
|
368
|
-
parts << %( style="#{style}") unless style.nil? || style.empty?
|
|
369
|
-
parts << %( width="#{escape_attr(width)}") unless width.nil?
|
|
370
|
-
parts << %( sizes="#{escape_attr(sizes)}") unless sizes.nil?
|
|
371
|
-
parts << %( srcset="#{escape_attr(srcset)}") unless srcset.nil?
|
|
372
|
-
"<img#{parts.join} />"
|
|
373
|
-
end
|
|
374
368
|
end
|
|
375
369
|
end
|
|
376
370
|
end
|
data/lib/mjml-rb/version.rb
CHANGED
data/mjml-rb.gemspec
CHANGED
|
@@ -18,6 +18,6 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
spec.bindir = "bin"
|
|
19
19
|
spec.executables = ["mjml"]
|
|
20
20
|
spec.require_paths = ["lib"]
|
|
21
|
-
spec.add_dependency "nokogiri"
|
|
22
|
-
spec.add_dependency "rexml"
|
|
21
|
+
spec.add_dependency "nokogiri", ">= 1.13"
|
|
22
|
+
spec.add_dependency "rexml", ">= 3.2.5"
|
|
23
23
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mjml-rb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrei Andriichuk
|
|
@@ -15,28 +15,28 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '
|
|
18
|
+
version: '1.13'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '
|
|
25
|
+
version: '1.13'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: rexml
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
32
|
+
version: 3.2.5
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version:
|
|
39
|
+
version: 3.2.5
|
|
40
40
|
description: Ruby-first MJML compiler API and CLI with compatibility-focused behavior.
|
|
41
41
|
email:
|
|
42
42
|
- andreiandriichuk@gmail.com
|