What difference does the "-" at the end make? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Philip Hallstrom
2009-Mar-18 16:27 UTC
Re: Whats the difference between "<%= abc %>" and "<%= abc -%>"
> What difference does the "-" at the end make?-%> eats the newline. .<%= abc %><%= xyz %>. will turn into .abc xyz . .<%= abc -%><%= xyz -%>. will turn into .abcxyz. -philip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
sultan
2009-Mar-18 17:26 UTC
Re: Whats the difference between "<%= abc %>" and "<%= abc -%>"
Thanks Philip, that makes sense. On Mar 18, 10:27 am, Philip Hallstrom <phi...-LSG90OXdqQE@public.gmane.org> wrote:> > What difference does the "-" at the end make? > > -%> eats the newline. > > .<%= abc %><%= xyz %>. will turn into > > .abc > xyz > . > > .<%= abc -%><%= xyz -%>. will turn into > > .abcxyz. > > -philip--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Colin Law
2009-Mar-18 21:00 UTC
Re: Whats the difference between "<%= abc %>" and "<%= abc -%>"
2009/3/18 Philip Hallstrom <philip-LSG90OXdqQE@public.gmane.org>> > > What difference does the "-" at the end make? > > -%> eats the newline. > > .<%= abc %><%= xyz %>. will turn into > > .abc > xyz > . > > .<%= abc -%><%= xyz -%>. will turn into > > .abcxyz. >According to Agile Development with Rails this is not quite correct. The - is supposed to remove the newline _after_ the -%> So <%= "abc" %><%= "def" %> <%= "ghi" %><%= "klm" %> will provide abcdef ghijkl but <%= "abc" %><%= "def" -%> <%= "ghi" %><%= "klm" %> will provide abcdefghijkl However on testing this in Rails 2.2.2 and viewing the source of the page, I am not seeing this. The - seems to make no difference, I see the two line output in both cases. Can anyone elucidate? Colin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Philip Hallstrom
2009-Mar-18 21:30 UTC
Re: Whats the difference between "<%= abc %>" and "<%= abc -%>"
> 2009/3/18 Philip Hallstrom <philip-LSG90OXdqQE@public.gmane.org> > >> >>> What difference does the "-" at the end make? >> >> -%> eats the newline. >> >> .<%= abc %><%= xyz %>. will turn into >> >> .abc >> xyz >> . >> >> .<%= abc -%><%= xyz -%>. will turn into >> >> .abcxyz. >> > > According to Agile Development with Rails this is not quite > correct. The - > is supposed to remove the newline _after_ the -%> > So > <%= "abc" %><%= "def" %> > <%= "ghi" %><%= "klm" %> > > will provide > > abcdef > ghijkl > > but > <%= "abc" %><%= "def" -%> > <%= "ghi" %><%= "klm" %> > > will provide > > abcdefghijkl > > However on testing this in Rails 2.2.2 and viewing the source of the > page, I > am not seeing this. The - seems to make no difference, I see the two > line > output in both cases. > > Can anyone elucidate?Ah... the -%> is only "end of line". Didn''t realize that. I just plugged this into 2.2.2: <%= "abc" %><%= "def" %> <%= "ghi" %><%= "klm" %> -------- <%= "abc" %><%= "def" -%> <%= "ghi" %><%= "klm" %> And got back this: abcdef ghiklm -------- abcdefghiklm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Greg Donald
2009-Mar-18 21:30 UTC
Re: Whats the difference between "<%= abc %>" and "<%= abc -%>"
On Wed, Mar 18, 2009 at 4:00 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> 2009/3/18 Philip Hallstrom <philip-LSG90OXdqQE@public.gmane.org> >> >> > What difference does the "-" at the end make? >> >> -%> eats the newline. >> >> .<%= abc %><%= xyz %>. will turn into >> >> .abc >> xyz >> . >> >> .<%= abc -%><%= xyz -%>. will turn into >> >> .abcxyz. > > According to Agile Development with Rails this is not quite correct. The - > is supposed to remove the newline _after_ the -%> > So > <%= "abc" %><%= "def" %> > <%= "ghi" %><%= "klm" %> > > will provide > > abcdef > ghijkl > > but > <%= "abc" %><%= "def" -%> > <%= "ghi" %><%= "klm" %> > > will provide > > abcdefghijkl > > However on testing this in Rails 2.2.2 and viewing the source of the page, I > am not seeing this. The - seems to make no difference, I see the two line > output in both cases. > > Can anyone elucidate? > > ColinChances are your web server supports some sort of output compression, so all this doesn''t really matter much. Surely you don''t depend on newlines to properly display a page, right? -- Greg Donald http://destiney.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Colin Law
2009-Mar-18 21:45 UTC
Re: Whats the difference between "<%= abc %>" and "<%= abc -%>"
2009/3/18 Philip Hallstrom <philip-LSG90OXdqQE@public.gmane.org>> > > snip.. > > Ah... the -%> is only "end of line". Didn''t realize that. > > I just plugged this into 2.2.2: > > <%= "abc" %><%= "def" %> > <%= "ghi" %><%= "klm" %> > > -------- > > <%= "abc" %><%= "def" -%> > <%= "ghi" %><%= "klm" %> > > And got back this: > > abcdef > ghiklm > > -------- > > abcdefghiklm > >Which is what you should get, I tried exactly the same and got abcdef ghiklm -------- abcdef ghiklm Which is not correct. Following a little head scratching I realised that that the erb file had windows line endings (\r\n) but I am now working on Ubuntu. I changed the line endings to Unix format and I got abcdefghiklm in the second case as expected. Is this a reportable bug? should the -%> not remove \r\n if present? Colin> > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
sultan
2009-Mar-19 17:38 UTC
Re: Whats the difference between "<%= abc %>" and "<%= abc -%>"
Is the -%> only used with a <%= ? Can it be used with, for example <% end -%> On Mar 18, 3:45 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> 2009/3/18 Philip Hallstrom <phi...-LSG90OXdqQE@public.gmane.org> > > > > > > > > snip.. > > > Ah... the -%> is only "end of line". Didn''t realize that. > > > I just plugged this into 2.2.2: > > > <%= "abc" %><%= "def" %> > > <%= "ghi" %><%= "klm" %> > > > -------- > > > <%= "abc" %><%= "def" -%> > > <%= "ghi" %><%= "klm" %> > > > And got back this: > > > abcdef > > ghiklm > > > -------- > > > abcdefghiklm > > Which is what you should get, I tried exactly the same and got > > abcdef > ghiklm > > -------- > > abcdef > ghiklm > > Which is not correct. Following a little head scratching I realised that > that the erb file had windows line endings (\r\n) but I am now working on > Ubuntu. I changed the line endings to Unix format and I got abcdefghiklm in > the second case as expected. > > Is this a reportable bug? should the -%> not remove \r\n if present? > Colin > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Colin Law
2009-Mar-19 18:19 UTC
Re: Whats the difference between "<%= abc %>" and "<%= abc -%>"
2009/3/19 sultan <sultan.bhatia-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> > Is the -%> only used with a <%= ? > Can it be used with, for example <% end -%> >Yes it can, in fact that is possibly the main use as it removes the line completely from the source. Also useful with ''for'' and so on. Colin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---