module Haml::Helpers
def surround(front, back = nil, &block)
*angry*
Produces:
%strong angry
= surround '*' do
and
(chicken)
Produces:
%a{:href => "food"} chicken
= surround '(', ')' do
For example:
with no whitespace in between.
Surrounds the given block of Haml code with the given characters,
def surround(front, back = nil, &block) back ||= front output = capture_haml(&block) "#{front}#{output.chomp}#{back}\n" end