MailchimpTemplate
Ruby implementation of Mailchimp's Template Language. Not everything works, but I'll add more support as I get requests.
Currently Supported Features
- [x] Generic Merge Tags
- [ ] System Merge Tags
- [ ] Conditional Merge Tags
- [x] Editable regions
- [ ] Repeatable regions
Installation
Add this line to your application's Gemfile:
gem 'mailchimp_template'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mailchimp_template
Usage
template = MailchimpTemplate.new("hello, *|MERGETAG|*")
template.render(merge_tags: {"MERGETAG" => "world"})
Editable regions
template = MailchimpTemplate.new('hello, <div mc:edit="body">lorem ipsum</body>')
template.render(regions: { "body" => "world" })
Contributing
- Fork it ( https://github.com/stevenkaras/mailchimp_template/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request