Multiverse-io / eextoheex

Automatic conversion of html.eex templates to heex
MIT License
37 stars 7 forks source link

Extra string interpolation generated #3

Closed reisub closed 3 years ago

reisub commented 3 years ago

Hi there, thanks for the nice tool - really speeds up converting templates to HEEX!

I ran into a small issue.

The input:

<pre x-ref="content" class="<%= content_lang_class(type) %>">
</pre>

will wrap the elixir code into another level of string interpolation:

<pre x-ref="content" class={"#{ content_lang_class(type) }"}>
</pre>

Ideally it should generate this:

<pre x-ref="content" class={ content_lang_class(type) }>
</pre>
reisub commented 3 years ago

... and then I re-read the README and figured that this is described as a limitation 😅 Sorry for the issue, closing now!

KristerV commented 3 years ago

mm, this is still a little bit confusing. Reading the official upgrade instructions this limitation doesn't seem to be mentioned. Do I understand correctly that booleans are the only worry here? Should mention something in the readme. Ideally would be an option, but not complaining, this tool has saved me so much time already - thank you!

edit: lol, the HEEX docs mention

Notice how you could simply use key={value}. HEEx will automatically handle special values such as false to remove the attribute or a list of classes.

But what are the special values? :)