Sha256: 32411cc55ef0b88f03a1f08a3e4d18cf2e7abae63c57693bf3552dd6a7c5f7c3

Contents?: true

Size: 745 Bytes

Versions: 41

Compression:

Stored size: 745 Bytes

Contents

# frozen_string_literal: true

module Nanoc::Filters
  # @api private
  class Slim < Nanoc::Filter
    identifier :slim

    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(filename, params) { content }.render(context) { assigns[:content] }
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
nanoc-4.11.0 lib/nanoc/filters/slim.rb
nanoc-4.10.4 lib/nanoc/filters/slim.rb
nanoc-4.10.3 lib/nanoc/filters/slim.rb
nanoc-4.10.2 lib/nanoc/filters/slim.rb
nanoc-4.10.1 lib/nanoc/filters/slim.rb
nanoc-4.10.0 lib/nanoc/filters/slim.rb
nanoc-4.9.9 lib/nanoc/filters/slim.rb
nanoc-4.9.8 lib/nanoc/filters/slim.rb
nanoc-4.9.7 lib/nanoc/filters/slim.rb
nanoc-4.9.6 lib/nanoc/filters/slim.rb
nanoc-4.9.5 lib/nanoc/filters/slim.rb
nanoc-4.9.4 lib/nanoc/filters/slim.rb
nanoc-4.9.3 lib/nanoc/filters/slim.rb
nanoc-4.9.2 lib/nanoc/filters/slim.rb
nanoc-4.9.1 lib/nanoc/filters/slim.rb
nanoc-4.9.0 lib/nanoc/filters/slim.rb
nanoc-4.8.19 lib/nanoc/filters/slim.rb
nanoc-4.8.18 lib/nanoc/filters/slim.rb
nanoc-4.8.17 lib/nanoc/filters/slim.rb
nanoc-4.8.16 lib/nanoc/filters/slim.rb