# File lib/staticmatic/helpers.rb, line 150
    def tag(name, options = {}, &block)
      options[:id] ||= options[:name] if options[:name]
      output = "<#{name}"
      options.keys.sort { |a, b| a.to_s <=> b.to_s }.each do |key|
        output << " #{key}=\"#{options[key]}\"" if options[key]
      end
      
      if block_given?
        output << ">"
        output << yield
        output << "</#{name}>"
      else
        format = @staticmatic.configuration.haml_options[:format]
        
        if format.nil? || format == :xhtml
          output << "/>"
        else
          output << ">"
        end
      end
      output
    end