Sha256: 80619fefed79e2a7ccc82fcdf49968c6b64b1801affea09a60c69068b18284a9

Contents?: true

Size: 680 Bytes

Versions: 42

Compression:

Stored size: 680 Bytes

Contents

module Nanoc::Filters
  # @api private
  class Haml < Nanoc::Filter
    requires 'haml'

    # 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::Int::Context.new(assigns)

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

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
nanoc-4.4.7 lib/nanoc/filters/haml.rb
nanoc-4.4.6 lib/nanoc/filters/haml.rb
nanoc-4.4.5 lib/nanoc/filters/haml.rb
nanoc-4.4.4 lib/nanoc/filters/haml.rb
nanoc-4.4.3 lib/nanoc/filters/haml.rb
nanoc-4.4.2 lib/nanoc/filters/haml.rb
nanoc-4.4.1 lib/nanoc/filters/haml.rb
nanoc-4.4.0 lib/nanoc/filters/haml.rb
nanoc-4.3.8 lib/nanoc/filters/haml.rb
nanoc-4.3.7 lib/nanoc/filters/haml.rb
nanoc-4.3.6 lib/nanoc/filters/haml.rb
nanoc-4.3.5 lib/nanoc/filters/haml.rb
nanoc-4.3.4 lib/nanoc/filters/haml.rb
nanoc-4.3.3 lib/nanoc/filters/haml.rb
nanoc-4.3.2 lib/nanoc/filters/haml.rb
nanoc-4.3.1 lib/nanoc/filters/haml.rb
nanoc-4.3.0 lib/nanoc/filters/haml.rb
nanoc-4.2.4 lib/nanoc/filters/haml.rb
nanoc-4.2.3 lib/nanoc/filters/haml.rb
nanoc-4.2.2 lib/nanoc/filters/haml.rb