This is a great question, because it delves into some of the tricky things that you can pull off in Mustache helpers, using can.view.hook, can.view.live, and the "inserted" event.
The real trick here is to grab the parent node of the element the first time it's attached, and use that, along with the parent's existing height (since after the first call it will already have markup) to check whether we should make new divs.
I've constructed a working and documented fiddle but it's probably a bit hard to understand for new users anyone:
http://jsfiddle.net/air_hadoken/6LpSs/3/
Ask any questions you have about it.