Jeff Cohen wrote:
> My (wild) guess is that it's actually your ERB tag that's adding the
> newline.
> 
> You can use a minus sign as part of the closing ERB tag to indicate
> that you don't want the newline:
> 
> <%= render :partial => 'blah' -%>

Aha, good point! I think you're right.

In general, for very white-space-dependent ERB partials, I'm finding it 
tricky to get the white space right. Are there any special tricks people 
have in general for controlling whitespace while still leaving readable 
views, other than <%- and -%>.  I know about those. But even with those, 
I'm finding I have to jam html tags together in order to get the 
whitespace I want.

Hmm, I just thought of one. Instead of an actual literal:

<div>
   content
</div>

in the html, which leaves no good way to control output whitespace 
without also making the HTML kind of hard to read, I could use:

<%- tag("div") do -%>
   <%- "content" -%>
<%- end -%>

Which lets me exercize complete control of whitespace supression without 
actually having to eliminate it in my source.  Does that make any sense, 
or is it completely ridiculous?  It's still kind of hard to read, but in 
deeply nested html, still not as hard to read as "<div>lots of 
stuff<div>more stuff<span>more stuff</span>stuff</div></div>" all jammed 
together without whitespace, because I don't want any whitespace in the 
output.
-- 
Posted via http://www.ruby-forum.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 [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.

Reply via email to