Sha256: 6acf0b9119861598d86ef8b7ac744090fbc7e228cf1512f5106f53338e189d7c

Contents?: true

Size: 708 Bytes

Versions: 3

Compression:

Stored size: 708 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

3 entries across 3 versions & 1 rubygems

Version Path
nanoc-4.0.0rc1 lib/nanoc/filters/slim.rb
nanoc-4.0.0b4 lib/nanoc/filters/slim.rb
nanoc-4.0.0b3 lib/nanoc/filters/slim.rb