mrml 1.10.0-aarch64-mingw-ucrt

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fa597371889f4afd3e5c6aaaf4eb510a6b323891fc75f2266ec3215bdfdbdfbd
4
+ data.tar.gz: 3ddb73cfec41a66056265c5a39a28a494704e905a95df62ff8453972a3c137fb
5
+ SHA512:
6
+ metadata.gz: 285ab7afd4eb4ce9956ec73a944090d49c350024e8f4174af1a40253ce61fa940d281c29ecec913f302604e66ab0c94816106d572a05e0cd51aa65e8dfee4914
7
+ data.tar.gz: e8c49ab5de8deba644e02e738f5ae4618db886ebb3992207980cef15f774d6d38ffba346c84bf171c434e479dc595d8575132f718d665dbac09826b0c783048d
@@ -0,0 +1,37 @@
1
+ # Code of Conduct
2
+
3
+ All participants of this project are expected to abide by our Code of Conduct, both online and during in-person events that are hosted and/or associated with this project.
4
+
5
+ ## The Pledge
6
+
7
+ In the interest of fostering an open and welcoming environment, we pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
8
+
9
+ ## The Standards
10
+
11
+ Examples of behavior that contributes to creating a positive environment include:
12
+
13
+ * Using welcoming and inclusive language
14
+ * Being respectful of differing viewpoints and experiences
15
+ * Referring to people by their preferred pronouns and using gender-neutral pronouns when uncertain
16
+ * Gracefully accepting constructive criticism
17
+ * Focusing on what is best for the community
18
+ * Showing empathy towards other community members
19
+
20
+ Examples of unacceptable behavior by participants include:
21
+
22
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
23
+ * Trolling, insulting/derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
26
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
27
+ * Dismissing or attacking inclusion-oriented requests
28
+
29
+ ## Enforcement
30
+
31
+ Violations of the Code of Conduct may be reported by sending an email to info@hardpixel.eu. All reports will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Further details of specific enforcement policies may be posted separately.
32
+
33
+ We hold the right and responsibility to remove comments or other contributions that are not aligned to this Code of Conduct, or to suspend temporarily or permanently any members for other behaviors that are inappropriate, threatening, offensive, or harmful.
34
+
35
+ ## Attribution
36
+
37
+ This Code of Conduct is adapted from [dev.to](https://dev.to/code-of-conduct).
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 jonian
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,146 @@
1
+ # MRML Ruby
2
+
3
+ Ruby wrapper for [MRML](https://github.com/jdrouet/mrml), the [MJML](https://mjml.io) markup language implementation in Rust. Rust must be available on your system to install this gem if you use a version below [v1.4.2](https://github.com/hardpixel/mrml-ruby/releases/tag/v1.4.2).
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/mrml.svg)](https://badge.fury.io/rb/mrml)
6
+ [![Build](https://github.com/hardpixel/mrml-ruby/actions/workflows/build.yml/badge.svg)](https://github.com/hardpixel/mrml-ruby/actions/workflows/build.yml)
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'mrml'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle install
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install mrml
23
+
24
+ ## Usage
25
+
26
+ ```ruby
27
+ require 'mrml'
28
+
29
+ mjml = <<-HTML
30
+ <mjml>
31
+ <mj-head>
32
+ <mj-title>Newsletter Title</mj-title>
33
+ <mj-preview>Newsletter Preview</mj-preview>
34
+ </mj-head>
35
+ <mj-body>
36
+ <mj-section>
37
+ <mj-column>
38
+ <mj-text font-size="20px" color="#F45E43" font-family="helvetica">Hello World</mj-text>
39
+ </mj-column>
40
+ </mj-section>
41
+ </mj-body>
42
+ </mjml>
43
+ HTML
44
+
45
+ # Using module methods
46
+ MRML.to_html(mjml) # Generate html from mjml
47
+ MRML.to_json(mjml) # Generate json from mjml
48
+ MRML.to_hash(mjml) # Generate hash from mjml
49
+
50
+ # Using Template class
51
+ template = MRML::Template.new(mjml)
52
+
53
+ template.title # Get template title
54
+ template.preview # Get template preview
55
+
56
+ template.to_html # Render as html
57
+ template.to_mjml # Render as mjml
58
+ template.to_json # Render as json
59
+ template.to_hash # Render as hash
60
+ ```
61
+
62
+ ```ruby
63
+ require 'mrml'
64
+
65
+ json = <<-JSON
66
+ {
67
+ "type": "mjml",
68
+ "children": [{
69
+ "type": "mj-head",
70
+ "children": [{
71
+ "type": "mj-title",
72
+ "children": "Newsletter Title"
73
+ }, {
74
+ "type": "mj-preview",
75
+ "children": "Newsletter Preview"
76
+ }]
77
+ }, {
78
+ "type": "mj-body",
79
+ "children": [{
80
+ "type": "mj-section",
81
+ "children": [{
82
+ "type": "mj-column",
83
+ "children": [{
84
+ "type": "mj-text",
85
+ "attributes": {
86
+ "font-size": "20px",
87
+ "color": "#F45E43",
88
+ "font-family": "helvetica"
89
+ },
90
+ "children": ["Hello World"]
91
+ }]
92
+ }]
93
+ }]
94
+ }]
95
+ }
96
+ JSON
97
+
98
+ # Create Template from JSON
99
+ template = MRML::Template.from_json(json)
100
+
101
+ template.to_html # Render as html
102
+ template.to_mjml # Render as mjml
103
+ template.to_json # Render as json
104
+ template.to_hash # Render as hash
105
+ ```
106
+
107
+ ## Benchmark
108
+
109
+ ```
110
+ Warming up --------------------------------------
111
+ mrml 3.071k i/100ms
112
+ mjml 1.000 i/100ms
113
+ Calculating -------------------------------------
114
+ mrml 40.927k (±14.2%) i/s ( 24.43 μs/i) - 199.615k in 5.058805s
115
+ mjml 1.774 (± 0.0%) i/s (563.81 ms/i) - 9.000 in 5.085477s
116
+
117
+ Comparison:
118
+ mrml: 40927.2 i/s
119
+ mjml: 1.8 i/s - 23075.08x slower
120
+
121
+ Calculating -------------------------------------
122
+ mrml 3.109k memsize ( 0.000 retained)
123
+ 2.000 objects ( 0.000 retained)
124
+ 1.000 strings ( 0.000 retained)
125
+ mjml 24.183k memsize ( 40.000 retained)
126
+ 110.000 objects ( 1.000 retained)
127
+ 28.000 strings ( 1.000 retained)
128
+
129
+ Comparison:
130
+ mrml: 3109 allocated
131
+ mjml: 24183 allocated - 7.78x more
132
+ ```
133
+
134
+ ## Development
135
+
136
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
137
+
138
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
139
+
140
+ ## Contributing
141
+
142
+ Bug reports and pull requests are welcome on GitHub at https://github.com/hardpixel/mrml-ruby.
143
+
144
+ ## License
145
+
146
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
Binary file
Binary file
data/lib/mrml/error.rb ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MRML
4
+ class Error < StandardError
5
+ end
6
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ module MRML
6
+ # Template object implemented in Rust that can parse MJML templates.
7
+ class Template
8
+ class << self
9
+ # @!method from_json(json)
10
+ # A new instance of Template from JSON.
11
+ # @!scope class
12
+ # @param json [String]
13
+ # @return [Template]
14
+ # @raise [Error] if json has invalid format
15
+
16
+ # A new instance of Template from Hash.
17
+ # @param hash [Hash]
18
+ # @return [Template]
19
+ # @raise [Error] if hash has invalid format
20
+
21
+ def from_hash(hash)
22
+ from_json(JSON.generate(hash))
23
+ end
24
+ end
25
+
26
+ # @!method initialize(mjml)
27
+ # A new instance of Template.
28
+ # @param mjml [String]
29
+ # @return [Template]
30
+ # @raise [Error] if mjml is not a valid template
31
+
32
+ # @!attribute [r] title
33
+ # Gets mj-title tag value.
34
+ # @return [String]
35
+
36
+ # @!attribute [r] preview
37
+ # Gets mj-preview tag value.
38
+ # @return [String]
39
+
40
+ # @!method to_mjml
41
+ # MJML representation of the template.
42
+ # @return [String]
43
+
44
+ # @!method to_json
45
+ # JSON representation of the template.
46
+ # @return [String]
47
+
48
+ # @!method to_html
49
+ # HTML representation of the template.
50
+ # @return [String]
51
+
52
+ # Hash representation of the template.
53
+ # @return [Hash]
54
+
55
+ def to_hash
56
+ JSON.parse(to_json)
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MRML
4
+ VERSION = '1.10.0'
5
+ end
data/lib/mrml.rb ADDED
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ RUBY_VERSION =~ /(\d+\.\d+)/
5
+ require "mrml/#{$1}/mrml"
6
+ rescue LoadError
7
+ require 'mrml/mrml'
8
+ end
9
+
10
+ require 'mrml/error'
11
+ require 'mrml/template'
12
+ require 'mrml/version'
13
+
14
+ # Module that renders MJML templates into HTML/JSON using MRML,
15
+ # a reimplementation of the MJML markup language in Rust.
16
+ module MRML
17
+ class << self
18
+ # Render template as HTML.
19
+ # @param mjml [String]
20
+ # @return (see Template#to_html)
21
+ # @raise (see Template#initialize)
22
+
23
+ def to_html(mjml)
24
+ return if mjml.nil?
25
+
26
+ template = Template.new(mjml)
27
+ template.to_html
28
+ end
29
+
30
+ # Render template as JSON.
31
+ # @param mjml [String]
32
+ # @return (see Template#to_json)
33
+ # @raise (see Template#initialize)
34
+
35
+ def to_json(mjml)
36
+ return if mjml.nil?
37
+
38
+ template = Template.new(mjml)
39
+ template.to_json
40
+ end
41
+
42
+ # Render template as Hash.
43
+ # @param mjml [String]
44
+ # @return (see Template#to_hash)
45
+ # @raise (see Template#initialize)
46
+
47
+ def to_hash(mjml)
48
+ return if mjml.nil?
49
+
50
+ template = Template.new(mjml)
51
+ template.to_hash
52
+ end
53
+ end
54
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mrml
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.10.0
5
+ platform: aarch64-mingw-ucrt
6
+ authors:
7
+ - Jonian Guveli
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-01-18 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Ruby wrapper for MRML, the MJML parser implementation in Rust.
14
+ email:
15
+ - jonian@hardpixel.eu
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - CODE_OF_CONDUCT.md
21
+ - LICENSE.txt
22
+ - README.md
23
+ - lib/mrml.rb
24
+ - lib/mrml/3.4/mrml.so
25
+ - lib/mrml/4.0/mrml.so
26
+ - lib/mrml/error.rb
27
+ - lib/mrml/template.rb
28
+ - lib/mrml/version.rb
29
+ homepage: https://github.com/hardpixel/mrml-ruby
30
+ licenses:
31
+ - MIT
32
+ metadata: {}
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '3.4'
42
+ - - "<"
43
+ - !ruby/object:Gem::Version
44
+ version: 4.1.dev
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubygems_version: 3.5.23
52
+ signing_key:
53
+ specification_version: 4
54
+ summary: Ruby wrapper for MRML Rust
55
+ test_files: []