calliope icon indicating copy to clipboard operation
calliope copied to clipboard

Attributes are often not parsed correctly

Open Qqwy opened this issue 7 years ago • 0 comments

This does not parse correctly:

iex> Calliope.Render.precompile(".foo{a: 1, b: mystruct.foo, data: %{foo: 3}}")
"<div class=\"foo\" a='<%= 1 %>' b='<%= mystruct %>'.foo data: %{foo='<%= 3 %>'></div>\n"

Note that instead of mystruct.foo being escaped, only mystruct is escaped.

Also note that the data attribute, which contains a nested map, is not properly turned into HTML, but its nested foo tag for some reason is. Ruby's HAML would turn nested maps into attributes separated with - (so %mytag{data: %{foo: 1, bar: 2} would result in <mytag data-foo=1 data-bar=2>), and I would also accept this to not work, and Calliope raising an error because a plain map does not implement the String.Chars protocol. The current output is clearly wrong and unusuable.

Qqwy avatar Jun 09 '17 15:06 Qqwy