mrml 1.4.2-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ca7bac6aa6e35d204ae01b0a16ffec905db5f0cc3bf25147a9367831d74108e2
4
+ data.tar.gz: 0bbc9ef6334f8fa2c61e78c7bcffe02193d54c23989de3ae28708c07b5f2a1cf
5
+ SHA512:
6
+ metadata.gz: 2bbe85fc25e495b9fc736ca591789ba3f8cdd7f66db21be4ff75043d19e4df17c0badeb18bd90e6a815970aa15c1a9d53e51006f1ea0d5e93e4369b3d56c6bcb
7
+ data.tar.gz: 4eecd6536af780eb91c080464dcd20b2573909fbf367bac2acbf334ccbe4644fe333e4c2e5eadbd244596c90cdae424af9550a696136e0853d719f9a3c55123b
@@ -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,120 @@
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.
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
+ [![Maintainability](https://api.codeclimate.com/v1/badges/7e307214d3c2e4d2056d/maintainability)](https://codeclimate.com/github/hardpixel/mrml-ruby/maintainability)
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'mrml'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle install
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install mrml
24
+
25
+ ## Usage
26
+
27
+ ```ruby
28
+ require 'mrml'
29
+
30
+ mjml = <<-HTML
31
+ <mjml>
32
+ <mj-head>
33
+ <mj-title>Newsletter Title</mj-title>
34
+ <mj-preview>Newsletter Preview</mj-preview>
35
+ </mj-head>
36
+ <mj-body>
37
+ <mj-section>
38
+ <mj-column>
39
+ <mj-text font-size="20px" color="#F45E43" font-family="helvetica">Hello World</mj-text>
40
+ </mj-column>
41
+ </mj-section>
42
+ </mj-body>
43
+ </mjml>
44
+ HTML
45
+
46
+ # Using module methods
47
+ MRML.to_html(mjml) # Generate html from mjml
48
+ MRML.to_json(mjml) # Generate json from mjml
49
+ MRML.to_hash(mjml) # Generate hash from mjml
50
+
51
+ # Using Template class
52
+ template = MRML::Template.new(mjml)
53
+
54
+ template.title # Get template title
55
+ template.preview # Get template preview
56
+
57
+ template.to_html # Render as html
58
+ template.to_mjml # Render as mjml
59
+ template.to_json # Render as json
60
+ template.to_hash # Render as hash
61
+ ```
62
+
63
+ ```ruby
64
+ require 'mrml'
65
+
66
+ json = <<-JSON
67
+ {
68
+ "type": "mjml",
69
+ "children": [{
70
+ "type": "mj-head",
71
+ "children": [{
72
+ "type": "mj-title",
73
+ "children": "Newsletter Title"
74
+ }, {
75
+ "type": "mj-preview",
76
+ "children": "Newsletter Preview"
77
+ }]
78
+ }, {
79
+ "type": "mj-body",
80
+ "children": [{
81
+ "type": "mj-section",
82
+ "children": [{
83
+ "type": "mj-column",
84
+ "children": [{
85
+ "type": "mj-text",
86
+ "attributes": {
87
+ "font-size": "20px",
88
+ "color": "#F45E43",
89
+ "font-family": "helvetica"
90
+ },
91
+ "children": ["Hello World"]
92
+ }]
93
+ }]
94
+ }]
95
+ }]
96
+ }
97
+ JSON
98
+
99
+ # Create Template from JSON
100
+ template = MRML::Template.from_json(json)
101
+
102
+ template.to_html # Render as html
103
+ template.to_mjml # Render as mjml
104
+ template.to_json # Render as json
105
+ template.to_hash # Render as hash
106
+ ```
107
+
108
+ ## Development
109
+
110
+ 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.
111
+
112
+ 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).
113
+
114
+ ## Contributing
115
+
116
+ Bug reports and pull requests are welcome on GitHub at https://github.com/hardpixel/mrml-ruby.
117
+
118
+ ## License
119
+
120
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
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.4.2'
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,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mrml
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.4.2
5
+ platform: x64-mingw32
6
+ authors:
7
+ - Jonian Guveli
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-09-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake-compiler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.2'
55
+ description: Ruby wrapper for MRML, the MJML parser implementation in Rust.
56
+ email:
57
+ - jonian@hardpixel.eu
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - CODE_OF_CONDUCT.md
63
+ - LICENSE.txt
64
+ - README.md
65
+ - lib/mrml.rb
66
+ - lib/mrml/3.0/mrml.so
67
+ - lib/mrml/error.rb
68
+ - lib/mrml/template.rb
69
+ - lib/mrml/version.rb
70
+ homepage: https://github.com/hardpixel/mrml-ruby
71
+ licenses:
72
+ - MIT
73
+ metadata: {}
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - - "<"
84
+ - !ruby/object:Gem::Version
85
+ version: 3.1.dev
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubygems_version: 3.4.4
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Ruby wrapper for MRML Rust
96
+ test_files: []