calliope icon indicating copy to clipboard operation
calliope copied to clipboard

Attributes: function evaluation without interpolation

Open phillipp opened this issue 8 years ago • 3 comments

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?

phillipp avatar Aug 18 '16 13:08 phillipp

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.

smpallen99 avatar Aug 18 '16 20:08 smpallen99

Care to elaborate? Tomorrow I have 10 offline hours in front of me with nothing to do and might want to check this out ;-)

phillipp avatar Aug 18 '16 21:08 phillipp

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.

smpallen99 avatar Aug 19 '16 01:08 smpallen99