syntax error, unexpected end-of-input on erb
Closed this issue · 8 comments
Might be the errant space in there, is this still an issue if you replace it with LocationService::LANGUAGE_REGION_CODES_WITH_ENGLISH
?
@effleurager the issue still exists if I remove the space
@effleurager the issue still exists if I remove the space
Can you send the full block for that if-statement?
@effleurager does this work?
<% if @alternates
Service::SOMETHING.each do |code| %>
<link rel="alternate" hreflang="<%= code[0..1] %>" href="">
<% end
@alternates[:with].each do |language, replacement| %>
<link rel="alternate" hreflang="<%= language %>" href="">
<% end %>
<% else %>
<link rel="alternate" hreflang="en" href="">
<% end %>
That gives a syntax error on line 2.
The following does work:
<% if @alternates %>
<% Service::SOMETHING.each do |code| %>
<link rel="alternate" hreflang="<%= code[0..1] %>" href="">
<% end %>
<% @alternates[:with].each do |language, replacement| %>
<link rel="alternate" hreflang="<%= language %>" href="">
<% end %>
<% else %>
<link rel="alternate" hreflang="en" href="">
<% end %>
@effleurager thanks for the workaround but isn't the code I pasted valid too?
Just checked, it actually is a workaround. The problem lies in Ripper requiring the block and if statements to be completed with end
. That requires taking adding \nend
twice as a code wrapper in
rufo/lib/rufo/erb_formatter.rb
Line 107 in b3f3aed
\nend
to be added for a given code string@effleurager @gingermusketeer thank you.