haml/haml — pull request #647 by mattwildig (2013-03-08 00:35:25+00:00)
Title: Add haml_tag_if helper method

Add a helper method that renders a block, conditionally wrapped in
another element.

I recently came across [a question on StackOverflow](http://stackoverflow.com/questions/15257069/conditional-top-level-tags-haml-w-o-using-partials) asking about this, where someone had referenced [another question](http://stackoverflow.com/questions/7237308/how-can-i-conditionally-wrap-some-haml-content-in-a-tag) where an answer in turn referred to a [mailing list post](https://groups.google.com/d/msg/haml/VgapK2sEsuY/jSb-P0N7jYMJ) where @nex3 proposed adding something like this as a helper and asked for feedback. Nothing came of it, so I’ve packaged it up with some tests and docs, since it seems there is at least some demand for this.