Sha256: 09394a9958693e5ba0898b588d07ea45ce9e72b9eddaac28a2f81a49e1bf5caf

Contents?: true

Size: 635 Bytes

Versions: 12

Compression:

Stored size: 635 Bytes

Contents

# encoding: utf-8

module Nanoc3::Filters
  class Haml < Nanoc3::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={})
      require 'haml'

      # Get options
      options = params.merge(:filename => filename)

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

      # Get result
      ::Haml::Engine.new(content, options).render(context, assigns) { assigns[:content] }
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
nanoc3-3.1.6 lib/nanoc3/filters/haml.rb
nanoc3-3.2.0a3 lib/nanoc3/filters/haml.rb
nanoc3-3.1.5 lib/nanoc3/filters/haml.rb
nanoc3-3.1.4 lib/nanoc3/filters/haml.rb
nanoc3-3.2.0a2 lib/nanoc3/filters/haml.rb
nanoc3-3.1.3 lib/nanoc3/filters/haml.rb
nanoc3-3.2.0a1 lib/nanoc3/filters/haml.rb
nanoc3-3.1.2 lib/nanoc3/filters/haml.rb
nanoc3-3.1.1 lib/nanoc3/filters/haml.rb
nanoc3-3.1.0 lib/nanoc3/filters/haml.rb
nanoc3-3.1.0rc1 lib/nanoc3/filters/haml.rb
nanoc3-3.1.0b2 lib/nanoc3/filters/haml.rb