On Mar 6, 4:36 ¨Âí¬ ÂòéáÃáîäìå¼â®ãáîä®®®Àðïâïø®ãïí÷òïôåº > RichardOnRails wrote in post #985685: > > > I haven't been able to get rid of those blank lines. ¨Âôèåò÷áù¿ > > It looks like erb comments don't support the -%> way of preventing the > blank lines. I tried both erb and eruby command-line tools. > > Regular ruby comments seem OK though: > > <% # Example from -%> > <% #http://www.linuxtopia.org/online_books/programming... -%> > This text is <% a = 100; print "#{a}% Live!" %> > > BTW it's bad practice to embed print inside erb (and you'll see the > 'erb' command line tool gives unexpected results, maybe other erb > implementations will too). This is because you may find erb being > assembled into a buffer and then printed at the end. > > Much better to use <%= ... %> to embed output. For example: > > This text is <% a = 100 %><%= "#{a}% Live!" %> > > or: > > This text is <%= a = 100; "#{a}% Live!" %> > > -- > Posted viahttp://www.ruby-forum.com/. Hi Brian, > I tried both erb and eruby command-line tools I didn't know there was an erb command-line executable. Thanks for that tidbit. > BTW it's bad practice to embed print inside erb Yeah, I thought that was a somewhat weird approach, but I wanted to get some of the published examples working before I began sticking in my 2-cents worth, aside from comments to compensate for my poor memory :-) I had completely run out of ideas. Thanks for experimenting with the "<% #" idea. I wound up with the following code (published at http://www.pastie.org/1641092), which works perfectly IMHO: === Start 9 lines (no newline at end of 9th line) ==== <% # Test_eruby_01.erb %> <% # K:\_Projects\Ruby\_Ruby_Tests\TestEruby %> <% # Example from %> <% # http://www.linuxtopia.org/online_books/programming_books/ruby_tutorial/Ruby_and_the_Web_Using_eruby.html %> <% # Usage: %> <% # eruby Test_eruby_01.erb %> <% # Published: %> <% # http://www.pastie.org/1641092 %> This text is <% a = 100; print "#{a}% Live!" %> === End 9 lines (4th line is split in this posting) === Output in Command Window (one line): === Start === K:\_Projects\Ruby\_Ruby_Tests\TestEruby>eruby Test_eruby_01.erb This text is 100% Live! K:\_Projects\Ruby\_Ruby_Tests\TestEruby> Best wishes, Richard