Sha256: 385ae71055abb05dd9ecef23ea06e1eb920fa5c61b979de65f13aa63347dedb4

Contents?: true

Size: 703 Bytes

Versions: 33

Compression:

Stored size: 703 Bytes

Contents

module Nanoc::Filters
  # @since 3.2.0
  #
  # @api private
  class Slim < Nanoc::Filter
    requires 'slim'

    # Runs the content through [Slim](http://slim-lang.com/).
    # This method takes no options.
    #
    # @param [String] content The content to filter
    #
    # @return [String] The filtered content
    def run(content, params = {})
      params = {
        disable_capture: true, # Capture managed by Nanoc
        buffer: '_erbout', # Force slim to output to the buffer used by Nanoc
      }.merge params

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

      ::Slim::Template.new(params) { content }.render(context) { assigns[:content] }
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
nanoc-4.4.4 lib/nanoc/filters/slim.rb
nanoc-4.4.3 lib/nanoc/filters/slim.rb
nanoc-4.4.2 lib/nanoc/filters/slim.rb
nanoc-4.4.1 lib/nanoc/filters/slim.rb
nanoc-4.4.0 lib/nanoc/filters/slim.rb
nanoc-4.3.8 lib/nanoc/filters/slim.rb
nanoc-4.3.7 lib/nanoc/filters/slim.rb
nanoc-4.3.6 lib/nanoc/filters/slim.rb
nanoc-4.3.5 lib/nanoc/filters/slim.rb
nanoc-4.3.4 lib/nanoc/filters/slim.rb
nanoc-4.3.3 lib/nanoc/filters/slim.rb
nanoc-4.3.2 lib/nanoc/filters/slim.rb
nanoc-4.3.1 lib/nanoc/filters/slim.rb
nanoc-4.3.0 lib/nanoc/filters/slim.rb
nanoc-4.2.4 lib/nanoc/filters/slim.rb
nanoc-4.2.3 lib/nanoc/filters/slim.rb
nanoc-4.2.2 lib/nanoc/filters/slim.rb
nanoc-4.2.1 lib/nanoc/filters/slim.rb
nanoc-4.2.0 lib/nanoc/filters/slim.rb
nanoc-4.1.6 lib/nanoc/filters/slim.rb