Sha256: 5778b2f6e670870e2d287fdc86d70c7bbc46fa6c56a379fc0f7ab3111b6e86d4

Contents?: true

Size: 679 Bytes

Versions: 15

Compression:

Stored size: 679 Bytes

Contents

# encoding: utf-8

require 'haml'

module Nanoc::Filters
  class Haml < Nanoc::Filter

    # Runs the content through [Haml](http://haml-lang.com/).
    # Parameters passed to this filter will be passed on to Haml.
    #
    # @param [String] content The content to filter
    #
    # @return [String] The filtered content
    def run(content, params={})
      # Get options
      options = params.merge(:filename => filename)

      # Create context
      context = ::Nanoc::Context.new(assigns)

      # Get result
      proc = assigns[:content] ? lambda { assigns[:content] } : nil
      ::Haml::Engine.new(content, options).render(context, assigns, &proc)
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
nanoc-3.5.0 lib/nanoc/filters/haml.rb
nanoc-3.5.0b2 lib/nanoc/filters/haml.rb
nanoc-3.5.0b1 lib/nanoc/filters/haml.rb
nanoc-3.4.3 lib/nanoc/filters/haml.rb
nanoc-3.4.2 lib/nanoc/filters/haml.rb
nanoc-3.4.1 lib/nanoc/filters/haml.rb
nanoc-3.4.0 lib/nanoc/filters/haml.rb
nanoc-3.3.7 lib/nanoc/filters/haml.rb
nanoc-3.3.6 lib/nanoc/filters/haml.rb
nanoc-3.3.5 lib/nanoc/filters/haml.rb
nanoc-3.3.4 lib/nanoc/filters/haml.rb
nanoc-3.3.3 lib/nanoc/filters/haml.rb
nanoc-3.3.2 lib/nanoc/filters/haml.rb
nanoc-3.3.1 lib/nanoc/filters/haml.rb
nanoc-3.3.0 lib/nanoc/filters/haml.rb