calliope
calliope copied to clipboard
Attributes: function evaluation without interpolation
Hi, I've wondered why string interpolation is necessary for setting attributes like this:
%tr{class: "#{my_function(my_data)}"}
I could not find an issue where this is discussed in detail. I'd rather like the following syntax (my_function may be replaced with MyModule.my_function):
%tr{class: my_function(my_data)}
What exactly is the problem with making this possible?
Its an issue in the parser and will require some refactoring to support.
On Aug 18, 2016, at 9:34 AM, phillipp [email protected] wrote:
Hi, I've wondered why string interpolation is necessary for setting attributes like this:
%tr{class: "#{my_function(my_data)}"} I could not find an issue where this is discussed in detail. I'd rather like the following syntax (my_function may be replaced with MyModule.my_function):
%tr{class: my_function(my_data)} What exactly is the problem with making this possible?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nurugger07/calliope/issues/72, or mute the thread https://github.com/notifications/unsubscribe-auth/AA2YpawyuKJRDBpAro4DQdfkjyne1iKaks5qhF9jgaJpZM4Jnfkw.
Care to elaborate? Tomorrow I have 10 offline hours in front of me with nothing to do and might want to check this out ;-)
Sure, parsing becomes difficult when you have to parse elixir code. For example, %tr{class: my_function(one,two), id: fun}
is difficult to parse. Much easier to parse ~r/“.*”/. I took at stab at this a while back but gave up on the full parsing and left it with support with string interpolation.
On Aug 18, 2016, at 5:16 PM, phillipp [email protected] wrote:
Care to elaborate? Tomorrow I have 10 offline hours in front of me with nothing to do and might want to check this out ;-)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nurugger07/calliope/issues/72#issuecomment-240859596, or mute the thread https://github.com/notifications/unsubscribe-auth/AA2Ypd8069P-spAjnD2G-MorrI38vvOjks5qhMu5gaJpZM4Jnfkw.