Return nil from capture id result isn't a String

Rail's capture helper returns nil if nothing is written to the buffer
and the result of the block isn't a String.

Change Haml's helper to match this behaviour.

Fixes #439