Skip to content

Commit

Permalink
Merge pull request #121 from adoptoposs/dependabot/cargo/native/mjml_…
Browse files Browse the repository at this point in the history
…nif/mrml-3.0.0

Bump mrml from 2.1.1 to 3.0.0 in /native/mjml_nif
  • Loading branch information
paulgoetze authored Dec 23, 2023
2 parents a14ac8e + 9a9dec6 commit 87a65dd
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ I.e. `mjml_nif 0.x` versions use mrml versions `>= 0.1, < 1.0.0`, and `mjml_nif

## [Unreleased]

## Changed
- Use [mrml] v.3.0.0, which fixes an issue with rendering not self-closing `<mj-font></mj-font>` tags. (See https://github.com/jdrouet/mrml/issues/356, [mrml diff v2.1.1..v3.0.0][mrml-v2.1.1-v3.0.0]).

## [2.0.0] - 2023-12-16

Expand Down Expand Up @@ -137,6 +139,7 @@ Initial release
[mrml]: https://github.com/jdrouet/mrml


[mrml-v2.1.1-v3.0.0]: https://github.com/jdrouet/mrml/compare/mrml-v2.1.1...mrml-v3.0.0
[mrml-v1.2.11-v2.1.1]: https://github.com/jdrouet/mrml/compare/v1.2.11...mrml-v2.1.1
[mrml-v1.2.10-v1.2.11]: https://github.com/jdrouet/mrml/compare/mrml-core-1.2.10...v1.2.11
[mrml-v1.2.9-v1.2.10]: https://github.com/jdrouet/mrml/compare/mrml-core-1.2.9...mrml-core-1.2.10
Expand Down
3 changes: 2 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ defmodule Mjml.MixProject do

defp package do
[
description: "Responsive emails made easy. NIF bindings for the MJML Rust implementation (mrml)",
description:
"Responsive emails made easy. NIF bindings for the MJML Rust implementation (mrml)",
maintainers: ["Paul Götze"],
licenses: ["MIT"],
files: ~w(lib native .formatter.exs README* LICENSE* mix.exs checksum-*.exs),
Expand Down
4 changes: 2 additions & 2 deletions native/mjml_nif/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion native/mjml_nif/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ crate-type = ["cdylib"]

[dependencies]
rustler = "0.30.0"
mrml = { version = "2.1", default-features = false, features = ["parse", "render", "orderedmap"] }
mrml = { version = "3.0", default-features = false, features = ["parse", "render", "orderedmap"] }

[features]
default = ["nif_version_2_15"]
Expand Down
18 changes: 15 additions & 3 deletions test/mjml_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,25 @@ defmodule MjmlTest do
test "transpiles the given MJML to HTML" do
mjml = """
<mjml>
<mj-head>
<mj-attributes>
<mj-all font-family="My Font"></mj-all>
</mj-attributes>
<mj-font name="My Font" href="https://myfontserver.example.com/css?family=My+Font"></mj-font>
<mj-font name="Other Font" href="https://myfontserver.example.com/css?family=Other+Font" />
</mj-head>
<mj-body>
<mj-section>
<mj-column>
<mj-image width="100px" src="logo.png" />
<mj-divider border-color="#F45E43" />
<mj-text font-size="20px" color="#F45E43" font-family="helvetica">
<mj-text font-size="20px" color="#F45E43" font-family="Other Font, helvetica">
<!-- my comment -->
Hello<br>Email!
</mj-text>
<mj-text>
This is a test.
</mj-text>
</mj-column>
</mj-section>
</mj-body>
Expand All @@ -24,6 +34,8 @@ defmodule MjmlTest do
assert String.ends_with?(html, "</html>")
assert html =~ "<!-- my comment -->"
assert html =~ "Hello<br />Email!"
assert html =~ "My Font"
assert html =~ "Other Font"
end

test "fails to parse invalid MJML" do
Expand Down Expand Up @@ -79,8 +91,8 @@ defmodule MjmlTest do

test "`fonts: %{\"font name\": \"font URL\", ...}` includes the given fonts" do
fonts = %{
"My Font": "https://myfontserver.example.com/css?family=My+Font:300,400,500,700",
"Your Font": "https://yourfontserver.example.com/css?family=Your+Font:300,400,500,700"
"My Font": "https://myfontserver.example.com/css?family=My+Font:300,400,500,700",
"Your Font": "https://yourfontserver.example.com/css?family=Your+Font:300,400,500,700"
}

mjml = """
Expand Down

0 comments on commit 87a65dd

Please sign in to comment.