Sha256: 631a24f8e3a2e2a0bcb8458ed677731190a6547d8d41334184b3019ef15964b4

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

module Haml
  module Helpers
    
    def stylesheets
      stylesheet_dir = "#{base_dir}/site/stylesheets/"
      output = ""
      Dir.entries(stylesheet_dir).each do |file|
        if file.match(/([a-z0-9_-]+)\.css$/)
          output << tag(:link, :href => "stylesheets/#{file}", :rel => 'stylesheet', :media => 'all')
        end
      end
      
      output
    end
    
    def javascripts(*files)
    end
    
    def text_field(name)
    end
    
    def submit(title)
    end
    
    def link(title, page = "")
      tag(:a, :href => page) { title }
    end
    
    def img(name, options = {})
      tag :img, options.merge!({:src => "images/#{name}"})
    end
  
    def tag(name, options = {}, &block)
      output = "<#{name}"
      options.each do |attribute, value|
        output << " #{attribute}=\"#{value}\""
      end
      
      if block_given?
        output << ">"
        output << yield
        output << "</#{name}>\n"
      else
        output << "/>\n"
      end
      output
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
staticmatic-0.0.1 lib/staticmatic/helpers.rb