Sha256: b5cb93676829411b5585a4d24c044a0ff64acc42434ec4a9d73642cd7d1067c3

Contents?: true

Size: 445 Bytes

Versions: 3

Compression:

Stored size: 445 Bytes

Contents

class String

  # Converts the string using Haml
  def haml(params={})
    nanoc_require 'haml'

    options = (params[:haml_options] || {})
    options[:locals] = params[:assigns] unless params[:assigns].nil?

    Haml::Engine.new(self, options).to_html
  end

end

register_filter 'haml' do |page, pages, config|
  assigns = { :page => page, :pages => pages }
  page.content.haml(:assigns => assigns, :haml_options => page[:haml_options])
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nanoc-1.6 lib/nanoc/filters/haml_filter.rb
nanoc-1.6.1 lib/nanoc/filters/haml_filter.rb
nanoc-1.6.2 lib/nanoc/filters/haml_filter.rb