-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Nested macros, comments, and macro variable lookup #4380
Comments
Now that I re-think about it, whether the line is commented or not doesn't make sense for macro code, but all I wanted was to comment a line in the macro, just to check something. I think there is currently no way to comment stuff in a macro without breaking like in OP. As we already have Maybe it's not a good idea to allow multiline commenting, as this could be abused to comment multiple lines in normal code, we could have |
I just realized I can comment macro stuff with: {% # comment
%}
# or (cleaner?)
{%
# comment
%}
# note: this doesn't work, as the %} is understood as part of the comment
{% # comment %} I would still prefer a dedicated syntax like Or maybe we can change the behevior for |
I just ran in to this using 1.4.1 class Base
macro inherited
macro foo(name)
# some comments \{{ name.id }}
def foo
puts "\{{ name.id }}"
end
end
end
end
class Foo < Base
foo bar
end
Foo.new.foo
To get around this, it looks like you can use class Base
macro inherited
{% verbatim do %}
macro foo(name)
# some comments {{name}}
def foo
puts "{{name.id}}"
end
end
{% end %}
end
end
class Foo < Base
foo bar
end
Foo.new.foo |
It's actually simpler: the macro foo(name)
# some comments \{{name.id}}
"\{{name.id}}"
{% debug %}
end
foo(hello) The output is:
but it should be:
|
https://carc.in/#/r/1zai
The escaped macro variable lookup isn't respected when the line is commented.
The text was updated successfully, but these errors were encountered: