ensure that captured blocks in erb and slim templates return nil, fixes #1582

Rebased on current master, doesn't require a new Slim version. Should work like this. I recommend pulling this one.