Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Not A Bug
-
Affects Version/s: JRuby 1.3.1
-
Fix Version/s: None
-
Component/s: Extensions
-
Labels:None
-
Environment:HideOS X 10.5.8/Java 6/Intel 64
9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
jruby 1.3.1 (ruby 1.8.6p287) (2009-06-15 2fd6c3d) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_15) [x86_64-java]ShowOS X 10.5.8/Java 6/Intel 64 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 jruby 1.3.1 (ruby 1.8.6p287) (2009-06-15 2fd6c3d) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_15) [x86_64-java]
-
Number of attachments :
Description
People are telling me I can squelch newlines in ERB templates by putting - around things, as in <%- foo -%> instead of <% bar %>
In practice, however, the following code works:
<% @categories.each do |item| %>
<category name="<%= item %>"/>
<% end %>
and the following code does not work:
<%- @categories.each do |item| -%>
<category name="<%= item %>"/>
<% end %>
and it results in:
SyntaxError at /xml
/Users/rjurney/JRuby/views/xml.erb:4: , unexpected ';'
- file: xml.erb
- location: render_erb
- line: 2
Confirmed on 1.4dev as well, with a better error:
~/projects/jruby ➔ jruby -e "require 'erb'; x = ERB.new(File.read('foo.erb')); p x.run" (erb):2: (erb):3: , unexpected ';' (SyntaxError) ; - @categories.each do |item| -; _erbout.concat "\n" ^ ~/projects/jruby ➔ cat foo.erb <% @categories.each do |item| %> <%- @categories.each do |item| -%> <% @categories.each do |item| -%>