On 20 October 2010 16:15, CiriusMex <[email protected]> wrote: > Ok, no luck here, I added "-" to the main page but still seeing > strange spaces. The weirdest thing is that in the generated html code > there is no html tag corresponding to those spaces...But still, my > tables and divs have a top white space I can't explain.
Please don't top post, it makes it difficult to follow the thread. Thanks. If you install firebug in firefox you can click on various sections of the page and get it to show you the css styles applicable to that element, and where that style has come from. This may give you a clue. Colin > > On 20 oct, 02:30, Michael Pavling <[email protected]> wrote: >> On 19 October 2010 23:22, CiriusMex <[email protected]> wrote: >> >> > Ok, I checked the doc but I don't fully understand: >> > - First what is the "-" you was talking about? I can't see any >> > reference to this >> >> The first line about ERb says "You trigger ERb by using embeddings >> such as <% %>, <% -%>, and <%= %>" >> >> > - Second about this: >> > "If you absolutely must write from within a function use concat. >> > suppress leading and trailing whitespace, including the trailing >> > newline, and can be used interchangeably with ." >> >> So you did see it - the "suppress leading and trailing whitespace" >> line that you quote part of (which probably due to HTML emails has >> gotten fubared) is talking about <%- and -%>. >> >> > Does it means I have to use functions to display my contents? I don't >> > get it... >> >> No. It says "if" - some people insist on doing smelly things - like >> rendering output while they're in functions - and *if* someone insists >> on doing that, it's better to use "concat" than to use ERb tags. But >> it's better yet to *not* output from functions at >> all.http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html... >> >> If you have a partial that does this: >> <% if true %> >> The outcome of the statement is <%= "true" %> >> <% end %> >> >> ...if you look in the source, you'll see some extra whitespace. If you >> care about getting rid of it at all (for the most part, I don't), you >> could do this instead: >> >> <%- if true -%> >> The outcome of the statement is <%= "true" -%> >> <%- end -%> >> >> ... or someone who spends more time fiddling with the rendering of >> Rails apps than I do will probably tell you that an *even better* >> solution is to use something like HAML. All these options are choices >> for you (since you were raising the issue of white-space) - nothing is >> set in stone. > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

