SparkPost / mandrill-sparkpost-templates

Translate Mandrill Handlebars templates into SparkPost templates
https://www.sparkpost.com/blog/mandrill-template-migration-tool-mst3k/
Other
6 stars 3 forks source link

Support for MailChimp merge tags? #6

Open ouranos opened 8 years ago

ouranos commented 8 years ago

Hi,

According to the README this tool should support MailChimp merge tags (*|variable|*).

However when I try to translate a really simple template:

Hi *|FIRST_NAME|*

It "translates" it as is. I'm expecting it to translate it to Hi {{first_name}}.

Is there something I'm missing?

ewandennis commented 8 years ago

Good point. It looks like our merge tag support is a little too stringent in that it doesn't support underscores in tag names. It also doesn't lowercase tag names during conversion and I think that might qualify as an unexpected effect. It might be better as an option.

ewandennis commented 8 years ago

Resolved in v0.1.2. Thanks for the feedback!

ouranos commented 8 years ago

Thanks!

It now works for variables but not for conditions.

For example:

*|IF:FIRST_NAME|*
Hi *|FIRST_NAME|*,
*|ELSE:|*
Hey there!
*|END:IF|*
ewandennis commented 8 years ago

Yup, we support basic merge tags syntax but not logic (yet) because the tool is broadly aimed at Mandrill handlebars syntax. However, we are always open to pull requests and in fact the MailChimp merge tags support came from a contributor.

ewandennis commented 8 years ago

I'm going to rename this issue to "MailChimp Merge Tags" to keep the intent clear.

ouranos commented 8 years ago

Ok. I'll see if I can find some time next week to try to implement this.

ouranos commented 8 years ago

See the attached pull request :)