Module: StaticMatic::Helpers::TagHelper

### Home Classes Methods

### In Files

- lib/staticmatic/helpers/tag_helper.rb

### Methods

- #tag

### Files

- LICENSE

### Class/Module Index

Quicksearch

- StaticMatic
- StaticMatic::Base
- StaticMatic::BuildMixin
- StaticMatic::Configuration
- StaticMatic::Error
- StaticMatic::Helpers
- StaticMatic::Helpers::AssetsHelper
- StaticMatic::Helpers::CurrentPathHelper
- StaticMatic::Helpers::FormHelper
- StaticMatic::Helpers::RenderHelper
- StaticMatic::Helpers::TagHelper
- StaticMatic::Helpers::UrlHelper
- StaticMatic::HelpersMixin
- StaticMatic::RenderMixin
- StaticMatic::RescueMixin
- StaticMatic::Server
- StaticMatic::ServerMixin
- StaticMatic::SetupMixin
- StaticMatic::TemplateError
- Compass
- Compass::AppIntegration
- Compass::AppIntegration::Staticmatic
- Compass::AppIntegration::Staticmatic::ConfigurationDefaults
- Compass::AppIntegration::Staticmatic::Installer

No matching classes.

# StaticMatic::Helpers::TagHelper

### Public Instance Methods

tag(name, options = {}, &block) click to toggle source

Generates HTML tags:

tag(:br) -> <br/> tag(:a, :href => 'test.html') { "Test" } -> <a href="test.html">Test</a>

    # File lib/staticmatic/helpers/tag_helper.rb, line 11
    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

[Validate]

Generated with the Darkfish Rdoc Generator 2.