nex3/haml — Issue #463: Bug: Removing whitespace around partial render inside ruby loop
Author: jasonkuhrt
Created: 2011-11-28 15:29:07+00:00
State: open

Given the following code, I cannot remove the whitespace between each `li` element.

-# some_list_partial.haml
%ul.list{:class => defined?(list_class) ? list_class : '' }>
- collection.each do |item|
= render(:partial => some_item_partial)

-# some_item_partial.haml
%li.item>
stuff....

Afte much frustration, I came up with the following solution:

-# some_list_partial.haml
%ul.list{:class => defined?(list_class) ? list_class : '' }>
- list_items = ""
- collection.each do |item|
- list_items += render(:partial => some_item_partial)
!= list_items

The bug here is the fact that `>` doesn't collapse the whitespace on each `li` element in the first version, in the `item` partial.