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

Ampersand produces </HIML_ERB_TAG> #7

Open
sakuro opened this issue Mar 24, 2019 · 2 comments
Open

Ampersand produces </HIML_ERB_TAG> #7

sakuro opened this issue Mar 24, 2019 · 2 comments

Comments

@sakuro
Copy link

sakuro commented Mar 24, 2019

Using safe navigation operator (&.), Himl 0.1.1 produces unexpected </HIML_ERB_TAG>.

without &.

require 'himl'

template = '<%= @x.nil? ? nil : @x.to_f %>'
@x = 1r/3

parser = Himl::Parser.new
puts parser.call(template).to_erb

produces

<%= @x.nil? ? '' : @x.to_f %>

with &.

require 'himl'

template = '<%= @x&.to_f %>'
@x = 1r/3

parser = Himl::Parser.new
puts parser.call(template).to_erb

produces

</HIML_ERB_TAG>
<%= @x&.to_f %>
@sakuro
Copy link
Author

sakuro commented Mar 24, 2019

Simpler one.

parser.call('<% x & y %>').to_erb

produces

</HIML_ERB_TAG>
<% x & y %>

Or, syntactically incorrect but

parser.call('<% & %>').to_erb

produces

</HIML_ERB_TAG>
<% & %>

@sakuro sakuro changed the title safe navigation operator Ampersand produces </HIML_ERB_TAG> Mar 24, 2019
@sakuro
Copy link
Author

sakuro commented Mar 24, 2019

<% < %> works similarly.

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

1 participant