Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smoothie Escaping Function -> #10

Closed
brandonparsons opened this issue Jan 25, 2017 · 11 comments
Closed

Smoothie Escaping Function -> #10

brandonparsons opened this issue Jan 25, 2017 · 11 comments
Assignees
Labels

Comments

@brandonparsons
Copy link

Hi there,

Not sure if I'm doing something incorrectly, but trying to repeat some HTML blocks in a template that is to be processed by smoothie:

                        <%= Enum.map child.activities, fn(activity) -> %>
                          <tr>
                            <td><%= activity.details %></td>
                            <td><%= activity.display_time %></td>
                          </tr>
                        <% end %>

It would appear that smoothie is escaping the -> at the end of the function literal:

                        <%= Enum.map child.activities, fn(activity) -&gt; %>
                          <tr>
                            <td style="-webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; mso-table-lspace: 0pt; mso-table-rspace: 0pt;"><%= activity.details %></td>
                            <td style="-webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; mso-table-lspace: 0pt; mso-table-rspace: 0pt;"><%= activity.display_time %></td>
                          </tr>
                        <% end %>

Note it has compiled to a -&gt;.

Is there a way I'm supposed to be doing this differently?

@jfrolich
Copy link
Owner

No this is probably a bug, nice find.

@brandonparsons
Copy link
Author

Is there a way to work around in the interim? How are you doing this kind of thing in your templates?

@jfrolich
Copy link
Owner

I have pretty simple templates. If you can find the bug I happily merge. I think it is caused by one of the escaping steps.

@jfrolich
Copy link
Owner

I only have time to look into it myself in a few days. 😬

@stephenmoloney
Copy link
Collaborator

stephenmoloney commented Jan 29, 2017

I also have a list of things to do as long as my arm.... 😨
I think, however, something I did before might fix this...
I'll try to take a look if a i get a chance later

@jfrolich
Copy link
Owner

jfrolich commented Jan 29, 2017

I wrote a test for it and it seems to succeed, can you check our elixir-smoothie npm package version?

The most recent version is 2.0.3.

@jfrolich
Copy link
Owner

jfrolich commented Jan 29, 2017

My mistake, it was indeed not working. Published a fix as elixir-smoothie 2.0.5. Let me know if it solved the issue for you.

@brandonparsons
Copy link
Author

Thanks for taking a look. Sorry for the slow reply - we have a new baby in the house :)

I'm having trouble getting up and running with smoothie, so am not having much luck figuring out if this fix worked!

Can variables in template_params only be primitives? Or can I pass in lists of structs?

@brandonparsons
Copy link
Author

I suspect my issues might be fixed by your new version mentioned in #11

@stephenmoloney stephenmoloney self-assigned this Mar 31, 2017
@stephenmoloney
Copy link
Collaborator

We should just create a test for this. I'll try to get to it eventually.

@jfrolich
Copy link
Owner

Yes this should be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants