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

Attributes: function evaluation without interpolation #72

Open
phillipp opened this issue Aug 18, 2016 · 3 comments
Open

Attributes: function evaluation without interpolation #72

phillipp opened this issue Aug 18, 2016 · 3 comments

Comments

@phillipp
Copy link
Contributor

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?

@smpallen99
Copy link
Collaborator

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 #72, or mute the thread https://github.com/notifications/unsubscribe-auth/AA2YpawyuKJRDBpAro4DQdfkjyne1iKaks5qhF9jgaJpZM4Jnfkw.

@phillipp
Copy link
Contributor Author

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

@smpallen99
Copy link
Collaborator

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 #72 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AA2Ypd8069P-spAjnD2G-MorrI38vvOjks5qhMu5gaJpZM4Jnfkw.

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

No branches or pull requests

2 participants